-
Couldn't load subscription status.
- Fork 21
Open
Labels
Description
When data is added to a table via add_column(), that column is not deleted when the table is overwritten with add_table(). Here is an example:
import orca
import pandas as pd
# Create a table
orca.add_table("my_table", pd.DataFrame({'a': [1, 2, 3]}))
# Add column
orca.add_column("my_table", "b", pd.Series([1000, 2000, 3000]))
# Check the column values
print(orca.get_table("my_table").b)
# Overwrite the table with new data
orca.add_table("my_table", pd.DataFrame({'c': [4, 5, 6]}))
# The new table still has the old column "b"! WRONG!
print(orca.get_table("my_table").b)
# Throws an error - CORRECT (the original local column not found)
print(orca.get_table("my_table").a)
Function add_table() does clear the cache in this line, but I think it also needs to iterate over _COLUMNS and _LOCAL_COLUMNS (maybe also other places) to delete the old data.