def reflect_db(self, db_key, db, dburl_to_reflect):
        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, db.sa_metadata)
        # make sure that everything was eager loaded, and update
        # db metadata from other thread XXX: dicey
        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()  # unhook SA
        db.reflecting = False
runs in a new thread
dataset/ETHPy150Open jaysw/ipydb/ipydb/metadata/__init__.py/MetaDataAccessor.reflect_db