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

sql - VB.NET Operand type clash: date is incompatible with int error -

SVG stroke-linecap doesn't work for circles in Firefox? -

python - TypeError: Scalar value for argument 'color' is not numeric in openCV -