Skip to content
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

feat: Add schema support to pgvector document store. #1095

Merged
merged 9 commits into from
Nov 14, 2024

Conversation

rblst
Copy link
Contributor

@rblst rblst commented Sep 20, 2024

Proposed Changes:

Add schema support to the pgvector document store.

You can now specify a schema for tables to be created in.

Manually tested these methods:

  • __init__
  • write_documents
  • delete_documents
  • filter_documents
  • delete_table

For manual tests, set the schema_name attribute, eg.:

document_store = PgvectorDocumentStore(
    schema_name="mysch",
    table_name="mytab",
    
    ...
) 

Notes for the reviewer

The schema must already exist in the database.

Using the public schema of a PostgreSQL database is an anti-pattern. This change adds support for using a schema other than the public schema to create tables.
@rblst rblst requested a review from a team as a code owner September 20, 2024 00:57
@rblst rblst requested review from silvanocerza and removed request for a team September 20, 2024 00:57
@CLAassistant
Copy link

CLAassistant commented Sep 20, 2024

CLA assistant check
All committers have signed the CLA.

@github-actions github-actions bot added integration:pgvector type:documentation Improvements or additions to documentation labels Sep 20, 2024
@anakin87
Copy link
Member

@rblst the idea sounds reasonable.
Can you fix the failing tests?

@anakin87 anakin87 self-requested a review November 14, 2024 18:08
Copy link
Member

@anakin87 anakin87 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made some small fixes.

I will merge this PR if tests pass!

@anakin87 anakin87 merged commit 3b33958 into deepset-ai:main Nov 14, 2024
7 checks passed
Amnah199 pushed a commit to ttmenezes/haystack-core-integrations that referenced this pull request Nov 15, 2024
* Add schema support for the pgvector document store.

Using the public schema of a PostgreSQL database is an anti-pattern. This change adds support for using a schema other than the public schema to create tables.

* Fix long lines.

* Fix long lines. Remove trailing spaces.

* Fix trailing spaces.

* Fix last trailing space.

* Fix ruff issues.

* Fix trailing space.

* small fixes

---------

Co-authored-by: Stefano Fiorucci <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integration:pgvector type:documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants