Gino: type object 'AsyncpgDBAPI' has no attribute 'Binary'

Created on 17 May 2018  路  3Comments  路  Source: python-gino/gino

I have scheme like that:

class Transaction(db.Model):
    __tablename__ = 'transaction'

    id = db.Column(db.Integer(), primary_key=True)
    data_hash = db.Column(db.LargeBinary())

Just tried to get item by binary data_has::

instance = await Transaction.query.where(Transaction.data_hash == hash).gino.first()

Where hash is a binary data (b"")

And got that exception:

File "/usr/local/lib/python3.6/site-packages/sqlalchemy/sql/sqltypes.py", line 873, in bind_processor DBAPIBinary = dialect.dbapi.Binary
sqlalchemy.exc.StatementError: (builtins.AttributeError) type object 'AsyncpgDBAPI' has no attribute 'Binary' [SQL: 'SELECT transaction.id, transaction.data_hash \nFROM transaction \nWHERE transaction.data_hash = $1']

(builtins.AttributeError) type object 'AsyncpgDBAPI' has no attribute 'Binary' [SQL: 'SELECT ransaction.id, ransaction.data_hash \nFROM transaction \nWHERE transaction.data_hash = $1']

I also tried to send request by asyncpg and it works.

bug

All 3 comments

Thanks for the report! It should have been fixed in master.

Reading https://www.python.org/dev/peps/pep-0249/#type-objects-and-constructors, I'm worrying about that SQLAlchemy may use the other types defined by DB-API, I'll check further.

Looks like you caught the only missing one for now. Cheers!

Thanks a lot!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

phoolish-philomath picture phoolish-philomath  路  3Comments

aprilmay picture aprilmay  路  3Comments

quantum13 picture quantum13  路  6Comments

saeedghx68 picture saeedghx68  路  4Comments

filantus picture filantus  路  3Comments