Skip to content

Commit 624f2b3

Browse files
author
Blake Rosenthal
committed
Allow inject.add_table to replace existing
1 parent 367d414 commit 624f2b3

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

activitysim/core/inject.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,12 @@ def add_step(name, func):
8484
return orca.add_step(name, func)
8585

8686

87-
def add_table(table_name, table):
88-
89-
if orca.is_table(table_name) and orca.table_type(table_name) == 'dataframe':
87+
def add_table(table_name, table, replace=False):
88+
"""
89+
Add new table and raise assertion error if the table already exists.
90+
Silently replace if replace=True.
91+
"""
92+
if not replace and orca.is_table(table_name) and orca.table_type(table_name) == 'dataframe':
9093
logger.warning("inject add_table replacing existing table %s" % table_name)
9194
assert False
9295

0 commit comments

Comments
 (0)