diff --git a/zipline/assets/assets.py b/zipline/assets/assets.py index f20e6389..d4a66896 100644 --- a/zipline/assets/assets.py +++ b/zipline/assets/assets.py @@ -82,36 +82,12 @@ class AssetFinder(object): self.engine = engine metadata = sa.MetaData(bind=engine) - self.equities = sa.Table( - 'equities', - metadata, - autoload=True, - autoload_with=engine, - ) - self.futures_exchanges = sa.Table( - 'futures_exchanges', - metadata, - autoload=True, - autoload_with=engine, - ) - self.futures_root_symbols = sa.Table( - 'futures_root_symbols', - metadata, - autoload=True, - autoload_with=engine, - ) - self.futures_contracts = sa.Table( - 'futures_contracts', - metadata, - autoload=True, - autoload_with=engine, - ) - self.asset_router = sa.Table( - 'asset_router', - metadata, - autoload=True, - autoload_with=engine, - ) + + table_names = ['equities', 'futures_exchanges', 'futures_root_symbols', + 'futures_contracts', 'asset_router'] + metadata.reflect(only=table_names) + for table_name in table_names: + setattr(self, table_name, metadata.tables[table_name]) # Cache for lookup of assets by sid, the objects in the asset lookp may # be shared with the results from equity and future lookup caches.