community: Register pandas df in duckdb when creating vector_store (#23690)

- **Description:** Register pandas df in duckdb when creating
vector_store
- **Issue:** Resolves #23308
- **Dependencies:** None
- **Twitter handle:** @timvw

Co-authored-by: Tim Van Wassenhove <tim.van.wassenhove@telenetgroup.be>
This commit is contained in:
Tim Van Wassenhove 2024-07-01 15:12:06 +02:00 committed by GitHub
parent b60df8bb4f
commit 24916c6703
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -191,6 +191,7 @@ class DuckDB(VectorStore):
if have_pandas: if have_pandas:
# noinspection PyUnusedLocal # noinspection PyUnusedLocal
df = pd.DataFrame.from_dict(data) # noqa: F841 df = pd.DataFrame.from_dict(data) # noqa: F841
self._connection.register("df", df)
self._connection.execute( self._connection.execute(
f"INSERT INTO {self._table_name} SELECT * FROM df", f"INSERT INTO {self._table_name} SELECT * FROM df",
) )