Hello,
I am having problems reflecting my tables from the MS SQL Server database
that have the schema "dbo". I have tried using the following code.
engine = db.create_engine("mssql+pyodbc:///?odbc_connect=%s" % params) #
Engine works, because I have tested it using CORE
meta = MetaData(schema="dbo") # I have tried binding it to engine as well
meta.reflect(bind=engine, schema="dbo") # I have tried without this line as
well
Base = automap_base(metadata=meta)
Base.prepare(engine, reflect=True)
### That seemed to work fine, I get no errors, however, if I try to
retrieve the name of the tables I can't see them:
Base.classes.keys()
>>> []
I have seen that the problem could be that the table doesn't have a primary
key, however that is not the problem, because I have multiple tables under
the schema "dbo" and they have primary keys.
If anyone knows a solution please let me know, I will be eternally grateful.
--
SQLAlchemy -
The Python SQL Toolkit and Object Relational Mapper
http://www.sqlalchemy.org/
To post example code, please provide an MCVE: Minimal, Complete, and Verifiable
Example. See http://stackoverflow.com/help/mcve for a full description.
---
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/sqlalchemy/d145fd44-5ffd-427b-869f-84d2cbd0bab1%40googlegroups.com.