mkleehammer/pyodbc

`engine.dialect.has_schema` does not work

leo-schick opened this issue · 1 comments

Environment

  • Python: Python 3.10.13 64 bit
  • pyodbc: pyodbc==5.0.1
  • OS: linux
  • DB: SQL Server
  • driver: ODBC Driver 18 for SQL Server

Issue

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

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