Skip to content

Fix: Table 'langchain_pg_collection' is already defined for this MetaData instance #209

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
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

0xrushi
Copy link

@0xrushi 0xrushi commented May 9, 2025

Possible solution for #165

Added thread locks to prevent multi table creation, optionally we can also pass extend_existing = True if required.

vector_store = PGVector(
    embeddings=OpenAIEmbeddings(),
    collection_name="test_collection",
    connection=connection_string,
    extend_existing=True,
)

@@ -428,6 +450,7 @@ def __init__(
self._engine: Optional[Engine] = None
self._async_engine: Optional[AsyncEngine] = None
self._async_init = False
self.extend_existing = extend_existing
Copy link
Contributor

Choose a reason for hiding this comment

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

This can be a private variable self._extend_existing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants