Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

'PGDDLCompiler' object has no attribute '_bind_processors'

See original GitHub issue

My 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

    'host': '',
    'port': 5432,
    'database': '***',
    'user': 'xtpids',
    'password': '***',
    'min_size': 5,
    'max_size': 10,

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/”, line 82, in execute return await conn.execute(*args, **kwargs) File “/home/wonder/PyEnvs/xtpids-BKbQCeJj/lib/python3.6/site-packages/asyncpgsa/”, line 105, in execute script, params = compile_query(script, dialect=self._dialect) File “/home/wonder/PyEnvs/xtpids-BKbQCeJj/lib/python3.6/site-packages/asyncpgsa/”, line 83, in compile_query params = _get_keys(compiled) File “/home/wonder/PyEnvs/xtpids-BKbQCeJj/lib/python3.6/site-packages/asyncpgsa/”, 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:open
  • Created 6 years ago
  • Comments:13 (3 by maintainers)

github_iconTop GitHub Comments

nhumrichcommented, Dec 7, 2017

You could try changing the dialect to psycopg dialect (slqalchemys default) and see if that helps: create_pool(dialect=sa.dialects.postgresql.psycopg2)

nhumrichcommented, Oct 5, 2018

This might be fixed now thanks to #94

Read more comments on GitHub >

github_iconTop Results From Across the Web

Beanstalkhq - Bountysource
This works fine with asyncpgsa version 0.27.1 and sqlalchemy: 1.3.23, but fails when I ... following exception: 'StrCompileDialect' object has no attribute ......
Read more >
Alembic: AttributeError: 'RedshiftDDLCompiler' object has no ...
I have this issue when I try to run upgrade on a migration that will change the type of a VARCHAR column to...
Read more >
'module' object has no attribute and ImportError - YouTube
This video covers the AttributeError: 'module' object has no attribute and ImportError: No module name errors in Python.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found