Skip to content

PgvectorDocumentStore: DB not initialized in delete_table method #1695

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
antrix opened this issue May 3, 2025 · 0 comments
Open

PgvectorDocumentStore: DB not initialized in delete_table method #1695

antrix opened this issue May 3, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@antrix
Copy link

antrix commented May 3, 2025

Describe the bug
The delete_table() and delete_table_async() methods do not call _ensure_db_setup() first. Thus, if delete_table() is the first call on the document store, it will fail.

To Reproduce

  1. Create a PgvectorDocumentStore instance.
  2. Call delete_table() on the instance.
app-sg-1 |  File "/app/core/admin.py", line 90, in save_model
app-sg-1 |    store.delete_table()
app-sg-1 |    ~~~~~~~~~~~~~~~~~~^^
app-sg-1 |  File "/py/lib/python3.13/site-packages/haystack_integrations/document_stores/pgvector/document_store.py", line 500, in delete_table
app-sg-1 |    self._execute_sql(
app-sg-1 |    ~~~~~~~~~~~~~~~~~^
app-sg-1 |        delete_sql,
app-sg-1 |        ^^^^^^^^^^^
app-sg-1 |        error_msg=f"Could not delete table {self.schema_name}.{self.table_name} in PgvectorDocumentStore",
app-sg-1 |        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app-sg-1 |    )
app-sg-1 |    ^
app-sg-1 |  File "/py/lib/python3.13/site-packages/haystack_integrations/document_stores/pgvector/document_store.py", line 270, in _execute_sql
app-sg-1 |    raise ValueError(message)
app-sg-1 |ValueError: The cursor or the connection is not initialized. Make sure to call _ensure_db_setup() before calling this method.

Describe your environment (please complete the following information):

  • OS: MacOS, Linux
  • Haystack version: haystack-ai==2.11.2
  • Integration version: pgvector-haystack==3.2.0
@antrix antrix added the bug Something isn't working label May 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant