pgvector-haystack 5.2.0__py3-none-any.whl → 5.3.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -534,6 +534,7 @@ class PgvectorDocumentStore:
534
534
  The name of the schema (`schema_name`) and the name of the table (`table_name`)
535
535
  are defined when initializing the `PgvectorDocumentStore`.
536
536
  """
537
+ self._ensure_db_setup()
537
538
  delete_sql = SQL("DROP TABLE IF EXISTS {schema_name}.{table_name}").format(
538
539
  schema_name=Identifier(self.schema_name),
539
540
  table_name=Identifier(self.table_name),
@@ -551,6 +552,7 @@ class PgvectorDocumentStore:
551
552
  """
552
553
  Async method to delete the table used to store Haystack documents.
553
554
  """
555
+ await self._ensure_db_setup_async()
554
556
  delete_sql = SQL("DROP TABLE IF EXISTS {schema_name}.{table_name}").format(
555
557
  schema_name=Identifier(self.schema_name),
556
558
  table_name=Identifier(self.table_name),
@@ -985,6 +987,38 @@ class PgvectorDocumentStore:
985
987
  error_msg="Could not delete documents from PgvectorDocumentStore",
986
988
  )
987
989
 
990
+ def delete_all_documents(self) -> None:
991
+ """
992
+ Deletes all documents in the document store.
993
+ """
994
+ query = SQL("TRUNCATE TABLE {schema_name}.{table_name}").format(
995
+ schema_name=Identifier(self.schema_name),
996
+ table_name=Identifier(self.table_name),
997
+ )
998
+
999
+ self._ensure_db_setup()
1000
+ assert self._cursor is not None
1001
+ self._execute_sql(
1002
+ cursor=self._cursor, sql_query=query, error_msg="Could not delete all documents from PgvectorDocumentStore"
1003
+ )
1004
+
1005
+ async def delete_all_documents_async(self) -> None:
1006
+ """
1007
+ Asynchronously deletes all documents in the document store.
1008
+ """
1009
+ query = SQL("TRUNCATE TABLE {schema_name}.{table_name}").format(
1010
+ schema_name=Identifier(self.schema_name),
1011
+ table_name=Identifier(self.table_name),
1012
+ )
1013
+
1014
+ await self._ensure_db_setup_async()
1015
+ assert self._async_cursor is not None
1016
+ await self._execute_sql_async(
1017
+ cursor=self._async_cursor,
1018
+ sql_query=query,
1019
+ error_msg="Could not delete all documents from PgvectorDocumentStore",
1020
+ )
1021
+
988
1022
  def _build_keyword_retrieval_query(
989
1023
  self, query: str, top_k: int, filters: Optional[Dict[str, Any]] = None
990
1024
  ) -> Tuple[Composed, tuple]:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pgvector-haystack
3
- Version: 5.2.0
3
+ Version: 5.3.0
4
4
  Summary: An integration of pgvector (vector search extension for Postgres) with Haystack
5
5
  Project-URL: Source, https://github.com/deepset-ai/haystack-core-integrations
6
6
  Project-URL: Documentation, https://github.com/deepset-ai/haystack-core-integrations/blob/main/integrations/pgvector/README.md
@@ -29,34 +29,16 @@ Description-Content-Type: text/markdown
29
29
  [![PyPI - Version](https://img.shields.io/pypi/v/pgvector-haystack.svg)](https://pypi.org/project/pgvector-haystack)
30
30
  [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/pgvector-haystack.svg)](https://pypi.org/project/pgvector-haystack)
31
31
 
32
- ---
32
+ - [Integration page](https://haystack.deepset.ai/integrations/pgvector-documentstore)
33
+ - [Changelog](https://github.com/deepset-ai/haystack-core-integrations/blob/main/integrations/pgvector/CHANGELOG.md)
33
34
 
34
- **Table of Contents**
35
+ ---
35
36
 
36
- - [pgvector-haystack](#pgvector-haystack)
37
- - [Installation](#installation)
38
- - [Testing](#testing)
39
- - [License](#license)
37
+ Refer to the general [Contribution Guidelines](https://github.com/deepset-ai/haystack-core-integrations/blob/main/CONTRIBUTING.md).
40
38
 
41
- ## Installation
39
+ To run integration tests locally, you need to have a PostgreSQL DB running with the `pgvector` extension.
40
+ You can start it using Docker:
42
41
 
43
42
  ```console
44
- pip install pgvector-haystack
45
- ```
46
-
47
- ## Testing
48
-
49
- Ensure that you have a PostgreSQL running with the `pgvector` extension. For a quick setup using Docker, run:
50
- ```
51
43
  docker run -d -p 5432:5432 -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=postgres -e POSTGRES_DB=postgres pgvector/pgvector:pg17
52
44
  ```
53
-
54
- then run the tests:
55
-
56
- ```console
57
- hatch run test:all
58
- ```
59
-
60
- ## License
61
-
62
- `pgvector-haystack` is distributed under the terms of the [Apache-2.0](https://spdx.org/licenses/Apache-2.0.html) license.
@@ -5,9 +5,9 @@ haystack_integrations/components/retrievers/pgvector/keyword_retriever.py,sha256
5
5
  haystack_integrations/document_stores/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
6
  haystack_integrations/document_stores/pgvector/__init__.py,sha256=Ge-7ggarfr3x8UqNdFHUuFGiu52u49sOVe3l16WEwZU,197
7
7
  haystack_integrations/document_stores/pgvector/converters.py,sha256=9ORG_Yb8Ss4eGGJB9ZGaDE25z89rLAh3ZisKwRww1bw,2937
8
- haystack_integrations/document_stores/pgvector/document_store.py,sha256=hztkxq4EM41okcaIQeTOT5GnbYeHr8Yjluebxfmgnpc,49763
8
+ haystack_integrations/document_stores/pgvector/document_store.py,sha256=EKrDg-nezEaRhEYnVhlTH7wmJ_w4sy5IfaaNq6mITaY,51009
9
9
  haystack_integrations/document_stores/pgvector/filters.py,sha256=jYdoXJZhAn3hNZTnx1x8K5Ok2LZzh-GB4hOhk6r7ZPk,9021
10
- pgvector_haystack-5.2.0.dist-info/METADATA,sha256=WQpcPn67Vuy3xKI4Cz2VZ4NKBtQ1Zh0z97_fsr-ZTuQ,2187
11
- pgvector_haystack-5.2.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
12
- pgvector_haystack-5.2.0.dist-info/licenses/LICENSE.txt,sha256=B05uMshqTA74s-0ltyHKI6yoPfJ3zYgQbvcXfDVGFf8,10280
13
- pgvector_haystack-5.2.0.dist-info/RECORD,,
10
+ pgvector_haystack-5.3.0.dist-info/METADATA,sha256=O_edb8lqV2SEZqbwb6Va_iC3Pu_p0GtxM_t95SEPNGo,2144
11
+ pgvector_haystack-5.3.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
12
+ pgvector_haystack-5.3.0.dist-info/licenses/LICENSE.txt,sha256=B05uMshqTA74s-0ltyHKI6yoPfJ3zYgQbvcXfDVGFf8,10280
13
+ pgvector_haystack-5.3.0.dist-info/RECORD,,