X-Git-Url: http://git.veekun.com/zzz-floof.git/blobdiff_plain/e080215f07b8153ef01d6c840a4ba3a4bfc2d770..d4cccab138ed3ac57f90d3c2f6766de41a275f11:/floof/model/meta.py diff --git a/floof/model/meta.py b/floof/model/meta.py index 1a20aa7..03d1f92 100644 --- a/floof/model/meta.py +++ b/floof/model/meta.py @@ -1,8 +1,9 @@ """SQLAlchemy Metadata and Session object""" from sqlalchemy import MetaData +from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import scoped_session, sessionmaker -__all__ = ['Session', 'engine', 'metadata'] +__all__ = ['Session', 'engine', 'TableBase'] # SQLAlchemy database engine. Updated by model.init_model() engine = None @@ -10,6 +11,6 @@ engine = None # SQLAlchemy session manager. Updated by model.init_model() Session = scoped_session(sessionmaker()) -# Global metadata. If you have multiple databases with overlapping table -# names, you'll need a metadata for each database -metadata = MetaData() +# Base class for declarative; creates its own metadata object +TableBase = declarative_base() +metadata = TableBase.metadata