

def get_metadata(self, engine, noisy=False, force=False, do_reflection=True):
    'Fetch metadata for an sqlalchemy engine'
    (db_key, ipydb_engine) = get_metadata_engine(engine)
    create_schema(ipydb_engine)
    db = self.databases[db_key]
    if db.reflecting:
        log.debug('Is already reflecting')
        return db
    if (not do_reflection):
        return db
    if force:
        log.debug('was foreced to re-reflect')
        db = db.read_expunge(ipydb_engine)
        self.databases[db_key] = db
        if noisy:
            print('ipydb is fetching database metadata')
        self.spawn_reflection_thread(db_key, db, engine.url)
        return db
    if (db.age > MAX_CACHE_AGE):
        log.debug('Cache expired age:%s reading from sqlite', db.age)
        db = self.read_expunge(ipydb_engine)
        self.databases[db_key] = db
        if (db.age > MAX_CACHE_AGE):
            log.debug('Sqlite data too old: %s, re-reflecting', db.age)
            if noisy:
                print('ipydb is fetching database metadata')
            self.spawn_reflection_thread(db_key, db, engine.url)
    return db

dataset/ETHPy150Open jaysw/ipydb/ipydb/metadata/__init__.py MetaDataAccessor.get_metadata/VarMisuse@95/149 `self`->`db`