pgvector-haystack 3.0.0__py3-none-any.whl → 3.0.1__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.
@@ -23,7 +23,7 @@ from .filters import _convert_filters_to_where_clause_and_params
23
23
  logger = logging.getLogger(__name__)
24
24
 
25
25
  CREATE_TABLE_STATEMENT = """
26
- CREATE TABLE IF NOT EXISTS {schema_name}.{table_name} (
26
+ CREATE TABLE {schema_name}.{table_name} (
27
27
  id VARCHAR(128) PRIMARY KEY,
28
28
  embedding VECTOR({embedding_dimension}),
29
29
  content TEXT,
@@ -310,13 +310,22 @@ class PgvectorDocumentStore:
310
310
  Creates the table to store Haystack documents if it doesn't exist yet.
311
311
  """
312
312
 
313
- create_sql = SQL(CREATE_TABLE_STATEMENT).format(
314
- schema_name=Identifier(self.schema_name),
315
- table_name=Identifier(self.table_name),
316
- embedding_dimension=SQLLiteral(self.embedding_dimension),
313
+ table_exists = bool(
314
+ self._execute_sql(
315
+ "SELECT 1 FROM pg_tables WHERE schemaname = %s AND tablename = %s",
316
+ (self.schema_name, self.table_name),
317
+ "Could not check if table exists",
318
+ ).fetchone()
317
319
  )
318
320
 
319
- self._execute_sql(create_sql, error_msg="Could not create table in PgvectorDocumentStore")
321
+ if not table_exists:
322
+ create_sql = SQL(CREATE_TABLE_STATEMENT).format(
323
+ schema_name=Identifier(self.schema_name),
324
+ table_name=Identifier(self.table_name),
325
+ embedding_dimension=SQLLiteral(self.embedding_dimension),
326
+ )
327
+
328
+ self._execute_sql(create_sql, error_msg="Could not create table in PgvectorDocumentStore")
320
329
 
321
330
  def delete_table(self):
322
331
  """
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pgvector-haystack
3
- Version: 3.0.0
3
+ Version: 3.0.1
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
@@ -2,9 +2,9 @@ haystack_integrations/components/retrievers/pgvector/__init__.py,sha256=n4q4pUAp
2
2
  haystack_integrations/components/retrievers/pgvector/embedding_retriever.py,sha256=IEIdgKy_IWgmL5Qy_Hqkwa2mq2JxnQ_JOdjm38JPxmE,7530
3
3
  haystack_integrations/components/retrievers/pgvector/keyword_retriever.py,sha256=SYHqjTkDczobYZ2qq0z8yS9p_g8aINnzwA5AN_nKdHI,5632
4
4
  haystack_integrations/document_stores/pgvector/__init__.py,sha256=Ge-7ggarfr3x8UqNdFHUuFGiu52u49sOVe3l16WEwZU,197
5
- haystack_integrations/document_stores/pgvector/document_store.py,sha256=bs1MCwiQgoTw8Wrad8DaRRgIQokk8_t1fLmzxdufWS4,31267
5
+ haystack_integrations/document_stores/pgvector/document_store.py,sha256=gzyJJkDdGFfi6gdpPjKpTw9Ya2dEY28p9HstSjiJbIU,31590
6
6
  haystack_integrations/document_stores/pgvector/filters.py,sha256=M-_wmM1iKS1QdKhnRk27N8t2W1st2YZWAwVSFUyyTtk,8508
7
- pgvector_haystack-3.0.0.dist-info/METADATA,sha256=1rd0uO91j_NxG5hmxXIhn7RFPYJsDgO9w7XBqKMMw-Q,2184
8
- pgvector_haystack-3.0.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
9
- pgvector_haystack-3.0.0.dist-info/licenses/LICENSE.txt,sha256=B05uMshqTA74s-0ltyHKI6yoPfJ3zYgQbvcXfDVGFf8,10280
10
- pgvector_haystack-3.0.0.dist-info/RECORD,,
7
+ pgvector_haystack-3.0.1.dist-info/METADATA,sha256=9xjXoMRnchq0NlQOflI_EQHdmn4fwZgwzLS7vkUVmIw,2184
8
+ pgvector_haystack-3.0.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
9
+ pgvector_haystack-3.0.1.dist-info/licenses/LICENSE.txt,sha256=B05uMshqTA74s-0ltyHKI6yoPfJ3zYgQbvcXfDVGFf8,10280
10
+ pgvector_haystack-3.0.1.dist-info/RECORD,,