Skip to content

add_table does not completely remove data from previously registered table #44

Description

@hanase

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.

Metadata

Metadata

Assignees

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions