Hello list,
Finally, a pure SA question from me. I'm using Automap and the "only"
keyword to automap a subset of the tables in our CMS database. This
has worked perfectly thus far. Now, though, it's failing on a specific
table, and the only difference I can see is that this table's name is
in all caps, whereas the rest are all lowercase. Capitalization
shouldn't matter, right? Stranger still, the actual reflection doesn't
error out. Later, where I try to assign base.classes.MYTABLE to a
variable, is where I get an AttributeError. Here's my code:

engine = sqlalchemy.create_engine("mssql+pyodbc://%s:%s@%s"
%(username, password, dsn))
base = automap_base()
session = Session(engine)
metadata = sqlalchemy.MetaData()
desiredTables = ["table", "othertable", "VENDR"]
metadata.reflect(engine, only=desiredTables) #works fine

table = base.classes.table #fine
table2 = base.classes.othertable #fine
vendorTable = base.classes.VENDR #AttributeError

I've added and removed tables as I adjust this script, and all of them
work perfectly. This VENDR table is the first one in two days to cause
problems. If I iterate over all the classes in base.classes and print
each one, I don't even see it in that list, so SA isn't simply
transforming the name. This is probably a simple thing, but I don't
see the problem. Thanks for any suggestions.

-- 
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 post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to