

def reflect_db(self, db_key, db, dburl_to_reflect):
    'runs in a new thread'
    db.reflecting = True
    target_engine = sa.create_engine(dburl_to_reflect)
    (db_key, ipydb_engine) = get_metadata_engine(target_engine)
    db.sa_metadata.bind = target_engine
    with timer('sa reflect', log=log):
        db.sa_metadata.reflect()
    with timer('drop-recreate schema', log=log):
        delete_schema(ipydb_engine)
        create_schema(ipydb_engine)
    with timer('Persist sa data', log=log):
        persist.write_sa_metadata(ipydb_engine, database.sa_metadata)
    with session_scope(ipydb_engine) as session:
        with timer('read-expunge after write', log=log):
            database = persist.read(session)
            db.update_tables(database.tables.values())
            db.sa_metadata = database.sa_metadata
            session.expunge_all()
    db.reflecting = False

dataset/ETHPy150Open jaysw/ipydb/ipydb/metadata/__init__.py MetaDataAccessor.reflect_db/VarMisuse@114/194 `db`->`database`