Skip to content

vector_store.create_collection() fails: AttributeError: 'NoneType' object has no attribute 'get_or_create' #27

Open
@amotl

Description

@amotl

Problem

    def create_collection(self) -> None:
        if self.pre_delete_collection:
            self.delete_collection()
        with self._make_sync_session() as session:
>           self.CollectionStore.get_or_create(
                session, self.collection_name, cmetadata=self.collection_metadata
            )
E           AttributeError: 'NoneType' object has no attribute 'get_or_create'

.venv/lib/python3.12/site-packages/langchain_postgres/vectorstores.py:542: AttributeError

Activity

amotl

amotl commented on Jan 29, 2025

@amotl
MemberAuthor

After helping with vector_store._init_models_with_dimensionality(3), it fails when invoking vector_store.create_collection().

E               sqlalchemy.exc.ProgrammingError: (crate.client.exceptions.ProgrammingError) RelationUnknown[Relation 'langchain_collection' unknown]
E               [SQL: SELECT langchain_collection.uuid AS langchain_collection_uuid, langchain_collection.name AS langchain_collection_name, langchain_collection.cmetadata AS langchain_collection_cmetadata
E               FROM langchain_collection
E               WHERE langchain_collection.name = ?
E                LIMIT ?]
E               [parameters: ('test_collection', 1)]
E               (Background on this error at: https://sqlalche.me/e/20/f405)

.venv/lib/python3.12/site-packages/crate/client/http.py:238: ProgrammingError
changed the title `vectorstore.create_collection()` fails: `AttributeError: 'NoneType' object has no attribute 'get_or_create'` `vector_store.create_collection()` fails: `AttributeError: 'NoneType' object has no attribute 'get_or_create'` on Jan 29, 2025
self-assigned this
on Jan 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

    Participants

    @amotl

    Issue actions

      `vector_store.create_collection()` fails: `AttributeError: 'NoneType' object has no attribute 'get_or_create'` · Issue #27 · crate/langchain-cratedb