Skip to content

Commit 99ab7a8

Browse files
committed
process_tracker_python-23 Data store initialization thru CLI
✨ CLI can now initialize data store (or drop and recreate) Found the issue to why drop_all and create_all were not working. Needed to include the schema for objects. Working on #23
1 parent 3bca063 commit 99ab7a8

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

process_tracker/data_store.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -115,17 +115,14 @@ def initialize_data_store(self, overwrite=False):
115115
self.logger.warn(
116116
"ALERT - DATA STORE TO BE OVERWRITTEN - ALL DATA WILL BE LOST"
117117
)
118-
self.session.commit()
119-
Base.metadata.drop_all(self.engine)
120118

121-
self.session.commit()
119+
for table in reversed(Base.metadata.sorted_tables):
120+
self.logger.info("Table will be deleted: %s" % table)
121+
table.drop(self.engine)
122+
122123
self.logger.info("Data store initialization beginning. Creating data store.")
123124
Base.metadata.create_all(self.engine)
124125

125-
# for table in Base.metadata.sorted_tables:
126-
# self.logger.info("Table will be created: %s" % table)
127-
# table.create(self.engine)
128-
129126
self.logger.info("Setting up application defaults.")
130127

131128
self.logger.info("Adding error types...")

0 commit comments

Comments
 (0)