-
Notifications
You must be signed in to change notification settings - Fork 0
How to debug from prompt a Table
Jorge Macias edited this page Mar 6, 2017
·
6 revisions
from sqlalchemy import create_engine from myapp import model from myapp.model import DBSession,Movie, Genre, Cast from sqlalchemy import inspect engine = create_engine('mysql://gpscontrol:qazwsxedc@127.0.0.1/movie') model.init_model(engine) model=DBSession.query(Movie).all() i = inspect(Movie) referred_classes = [r.mapper.class_ for r in i.relationships] from myapp.model import DeclarativeBase metadata = DeclarativeBase.metadata metadata.bind = engine d = {k: metadata.tables[k].columns.keys() for k in metadata.tables.keys()} print(d)