mkleehammer / pyodbc

Python ODBC bridge
https://github.com/mkleehammer/pyodbc/wiki
MIT No Attribution
2.95k stars 563 forks source link

`engine.dialect.has_schema` does not work #1312

Closed leo-schick closed 11 months ago

leo-schick commented 11 months ago

Environment

Issue

The method sqlalchemy.engine.Dialect.has_schema is not implemented in pyodbc.

gordthompson commented 11 months ago

That method is part of the SQLAlchemy dialect. The documentation you cite says

This is an internal dialect method. Applications should use Inspector.has_schema().

and that does work:

import sqlalchemy as sa

engine = sa.create_engine("mssql+pyodbc://scott:tiger^5HHH@mssql_199")

insp = sa.inspect(engine)
print(insp.has_schema("dbo"))  # True
print(insp.has_schema("non_existent"))  # False