Skip to content

Commit 4ed9b13

Browse files
Update langchain_postgres/vectorstores.py
Co-authored-by: Martín Gotelli Ferenaz <[email protected]>
1 parent 5c2fd97 commit 4ed9b13

File tree

1 file changed

+3
-12
lines changed

1 file changed

+3
-12
lines changed

langchain_postgres/vectorstores.py

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -222,25 +222,16 @@ class EmbeddingStore(Base):
222222
document = sqlalchemy.Column(sqlalchemy.String, nullable=True)
223223
cmetadata = sqlalchemy.Column(JSONB, nullable=True)
224224

225-
if extend_existing:
226-
__table_args__ = (
227-
sqlalchemy.Index(
228-
"ix_cmetadata_gin",
229-
"cmetadata",
230-
postgresql_using="gin",
231-
postgresql_ops={"cmetadata": "jsonb_path_ops"},
232-
),
233-
{'extend_existing': True}
234-
)
235-
else:
236-
__table_args__ = (
225+
__table_args__ = (
237226
sqlalchemy.Index(
238227
"ix_cmetadata_gin",
239228
"cmetadata",
240229
postgresql_using="gin",
241230
postgresql_ops={"cmetadata": "jsonb_path_ops"},
242231
),
243232
)
233+
if extend_existing:
234+
__table_args__ = __table_args__ + ({'extend_existing': True}, )
244235

245236
_classes = (EmbeddingStore, CollectionStore)
246237

0 commit comments

Comments
 (0)