Hi Mike, It looks like my Base class was not exactly the same (although it was in my original code), but this is not the problem. I have a custom "DatabaseConnection" Python class that is a singleton and encapsulates the database connection. It's constructed like this:
me.engine = create_engine(me.database_connection_string, echo=False) me.metadata = MetaData() me.metadata.bind = me.engine me.Base = declarative_base(bind=me.engine) me.Session = scoped_session(sessionmaker(bind=me.engine, autocommit=True)) "me" refers to the cls (i.e. "self"). When I later call DatabaseConnection (my variable dbc, the singleton), I access the metadata, Base, and Session from it. You pointed out that my metadata was not the same instance. I found if I later call "dbc.Base", the metadata is empty, whereas if later I use the singleton and call: Base = declarative_base(bind=dbc.engine) this works. (In fact, this has been my pattern for years.) I don't know why the Base defined as above remains empty while a later call to "declarative_base" from another file works, but it's not crucial. To your original question, this is what I get back from the metadata. ipdb> Base.metadata.tables.keys() dict_keys(['file.fits_header_keyword', 'file.fits_header_comment', 'trillian.dataset', 'file.fits_hdu', 'file.fits_header_value', 'trillian.dataset_release', 'file.file_kind', 'file.fits_file', 'file.base_path']) Thanks, Demitri -- 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 sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at https://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.