python - BIT 0 represented as '\x00' -


in database table have column defined as: enter image description here

using query: query = text( "select * %s " % "atable" "%s=%s , " % ("done", 0) )

    result = engine.execute(query)     row = result.fetchone() 

when call print row['done'] '\x00'.

for generation of tables sqlacodegen generated done columns this:

column('done', bit(1), nullable=false), 

am missing configuration in sqlalchemy? don't want convert hex int everywhere goint use bit column.

edit problem not sqlalchemy seems pymysql blame.

try have chapter of python documentation.

however, in case, might enough ord convert hex:

>>> = b'\x00'  >>> '\x00' >>> str(a) '\x00' >>> ord(a) 0 >>> ord('\x5f') 95 

Comments

Popular posts from this blog

android - Why am I getting the message 'Youractivity.java is not an activity subclass or alias' -

python - How do I create a list index that loops through integers in another list -

c# - “System.Security.Cryptography.CryptographicException: Keyset does not exist” when reading private key from remote machine -