python - BIT 0 represented as '\x00' -
in database table have column defined as:
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
Post a Comment