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' -

Making Empty C++ Project: General exception (Exception from HRESULT:0x80131500) Visual Studio Community 2015 -

How to fix java warning for "The value of the local variable is not used " -