mirror of
https://github.com/wassname/catalyst.git
synced 2026-06-30 19:06:50 +08:00
ENH: Add init_db to transaction so table exists=>it has also been written to
This commit is contained in:
@@ -110,11 +110,13 @@ class AssetDBWriter(with_metaclass(ABCMeta)):
|
||||
|
||||
"""
|
||||
self.allow_sid_assignment = allow_sid_assignment
|
||||
# Create SQL tables
|
||||
self.init_db(engine, constraints)
|
||||
# Get the data to add to SQL
|
||||
data = self.load_data()
|
||||
|
||||
with engine.begin() as txn:
|
||||
# Create SQL tables.
|
||||
self.init_db(txn, constraints)
|
||||
# Get the data to add to SQL.
|
||||
data = self.load_data()
|
||||
# Write the data to SQL.
|
||||
self._write_exchanges(data.exchanges, txn)
|
||||
self._write_root_symbols(data.root_symbols, txn)
|
||||
self._write_futures(data.futures, txn)
|
||||
|
||||
Reference in New Issue
Block a user