Hello,
I’m curious to get recommendations about the following use-case (based on
this SO Answer):
>>> import sqlalchemy
>>> configuration = {'sqlalchemy.url': 'postgresql+psycopg2://postgres:postgres@localhost/test_db'}
>>> engine = sqlalchemy.engine_from_config(configuration, future=True)
>>> engine.dialect.has_schema(engine, schema)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/.../lib/python3.10/site-packages/sqlalchemy/dialects/postgresql/base.py", line 3360, in has_schema
cursor = connection.execute(
File "/.../lib/python3.10/site-packages/sqlalchemy/future/engine.py", line 320, in _not_implemented
raise NotImplementedError(
NotImplementedError: This method is not implemented for SQLAlchemy 2.0.
This works if I turn off the
future flag:
>>> engine = sqlalchemy.engine_from_config(configuration)
>>> engine.dialect.has_schema(engine, schema)
False
For now I can use an “old” engine to check for schema, and the switch to a new one, but what’s the current recommendation?
Much thanks!
Jens