get_usable_table_names returning no tables, at all when scurity is confirmed and MSSql Database has tables. See screenshot #28329
Replies: 6 comments 3 replies
-
I even tried as 'sa'. same result. |
Beta Was this translation helpful? Give feedback.
-
Also, to test the database and odbc I created an odbc (ver 17) connection and tested it in excel. See screenshot attached. Same Creds. |
Beta Was this translation helpful? Give feedback.
-
@AlbertLotito I have a few theories. First, confirm if the URL is correct by trying this: from sqlalchemy import create_engine
from sqlalchemy.exc import OperationalError
dburl = "mssql+pyodbc:///?odbc_connect=..."
try:
engine = create_engine(dburl)
connection = engine.connect()
print("Connection successful!")
connection.close()
except OperationalError as e:
print("Connection failed!")
print(e) Or perhaps the issue is the schema where the tables are located? Try passing it with |
Beta Was this translation helpful? Give feedback.
-
so, result: The Result: the Code: Connection string for MS SQL Serverconnection_string = ( db = SQLDatabase.from_uri(f"mssql+pyodbc:///?odbc_connect={connection_string}") from sqlalchemy import create_engine dburl = "mssql+pyodbc://DB_Dudskie:PitterPatter!@dawoz" try: |
Beta Was this translation helpful? Give feedback.
-
Additionally, I tried: with engine.connect() as connection:
And it returned all tables |
Beta Was this translation helpful? Give feedback.
-
FML. I am glad I can confirm the the database and permissions are correct. Now to dive down the .get_usable_table_names rabbit hole. @feijoes, Thank you. I appreciate you taking the time to guide me. I have been coding for decades but am new to python and LLMs... quite the journey. |
Beta Was this translation helpful? Give feedback.
-
Checked other resources
Commit to Help
Example Code
Description
I am using get_usable_table_names and it returns an empty list.
See screenshot showing the database connected in SSMS, under the same security context; with the tables listed.
I have a fresh install of all relevant libraries, and python (fresh install today.)
All installed modules/libs in modules.txt.
Screenshot attached.
Python Version: 3.13.0
Modules.txt
Modules.txt
System Info
Microsoft SQL Server Developer (64-bit) (16.0.1135.2)
Testing against the WideWorldImportersDW sample DB from microsoft.
System Information
Package Information
Other Dependencies
Beta Was this translation helpful? Give feedback.
All reactions