-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Labels
enhancementNew feature or requestNew feature or request
Milestone
Description
- If you are creating a new connection, create the table structure in advance.
if self.mode == DBMode.OVERWRITE:
# Delete files first because duckdb.connect() does not have an overwrite option.
self.path.unlink(missing_ok=True)
return create_table()
return ddb.connect(str(self.path))
add create_table()
.
2. Fix write_data
(Assumption that 1. is correctly implemented)
def write_data(self, src: pl.LazyFrame) -> ddb.DuckDBPyConnection:
def get_only_additional(new: pl.LazyFrame) -> pl.LazyFrame:
original = self.to_ldf()
return new.join(original, on="number", how="anti")
if self.mode == DBMode.DELTA:
src = get_only_additional(src)
self.conn.sql(f"INSERT INTO {self.top_table} SELECT * FROM src")
return self.conn
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request