def status(command, args): bind_metadata() get_model() ret = compare_metadata(metadata, MetaData(metadata.bind)) for l in ret: print l if not ret: print "Database matches model"
def run(self): """Run the shell""" self.find_config() locals = dict(__name__="tg-admin") try: mod = get_model() if mod: locals.update(mod.__dict__) except (pkg_resources.DistributionNotFound, ImportError), e: mod = None print "Warning: Failed to import your data model: %s" % e print "You will not have access to your data model objects." print
def list_(command, args): get_model() for tbl in metadata.tables.values(): print tbl.fullname
def create(command, args): print "Creating tables at %s" % (config.get("sqlalchemy.dburi")) bind_metadata() get_model() metadata.create_all()