'PGDDLCompiler' object has no attribute '_bind_processors'
See original GitHub issueMy envs
- Python 3.6.3
- asyncpgsa==0.18.1
- asyncpg==0.12.0
- sqlalchemy==1.1.15
My code sample
from asyncpgsa import PG
from app import app
DB_CONFIG = {
'host': '172.17.0.3',
'port': 5432,
'database': '***',
'user': 'xtpids',
'password': '***',
'min_size': 5,
'max_size': 10,
}
@app.listener('before_server_start')
async def init_db(*args, **kwargs):
# Initializing a db singleton before server start
pg = PG()
await pg.init(**DB_CONFIG)
app.db = pg
return app.db
# Create tables in some script
tables = Base.metadata.tables
for name, table in tables.items():
create_expr = CreateTable(table)
await app.db.execute(create_expr)
The exception
… File “/home/wonder/PyEnvs/xtpids-BKbQCeJj/lib/python3.6/site-packages/asyncpgsa/pgsingleton.py”, line 82, in execute return await conn.execute(*args, **kwargs) File “/home/wonder/PyEnvs/xtpids-BKbQCeJj/lib/python3.6/site-packages/asyncpgsa/connection.py”, line 105, in execute script, params = compile_query(script, dialect=self._dialect) File “/home/wonder/PyEnvs/xtpids-BKbQCeJj/lib/python3.6/site-packages/asyncpgsa/connection.py”, line 83, in compile_query params = _get_keys(compiled) File “/home/wonder/PyEnvs/xtpids-BKbQCeJj/lib/python3.6/site-packages/asyncpgsa/connection.py”, line 43, in _get_keys processors = compiled._bind_processors AttributeError: ‘PGDDLCompiler’ object has no attribute ‘_bind_processors’
My analysis
In sqlalchemy’s source, only SQLCompiler has _bind_processors
property.
However create_expr.compile(dialect=asyncpgsa.connection._dialect)
generates an instance of type PGDDLCompiler(DDLCompiler)
, of which SQLCompiler
isn’t a base class.
Issue Analytics
- State:
- Created 6 years ago
- Comments:13 (3 by maintainers)
Top GitHub Comments
You could try changing the dialect to psycopg dialect (slqalchemys default) and see if that helps:
create_pool(dialect=sa.dialects.postgresql.psycopg2)
http://docs.sqlalchemy.org/en/latest/dialects/postgresql.html#module-sqlalchemy.dialects.postgresql.psycopg2
This might be fixed now thanks to #94