Skip to content
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

[Bug]: sqlite3.OperationalError: no such column: collections.topic #2144

Open
pseudotensor opened this issue May 6, 2024 · 7 comments
Open
Labels
bug Something isn't working

Comments

@pseudotensor
Copy link

What happened?


  File "/home/tomershm/h2ogpt/src/gpt_langchain.py", line 4519, in get_existing_db
    db = chroma_class(persist_directory=persist_directory, embedding_function=embedding,
  File "/home/tomershm/miniconda3/envs/h2ogpt/lib/python3.10/site-packages/langchain_community/vectorstores/chroma.py", line 126, in __init__
    self._collection = self._client.get_or_create_collection(
  File "/home/tomershm/miniconda3/envs/h2ogpt/lib/python3.10/site-packages/chromadb/api/client.py", line 237, in get_or_create_collection
    return self._server.get_or_create_collection(
  File "/home/tomershm/miniconda3/envs/h2ogpt/lib/python3.10/site-packages/chromadb/telemetry/opentelemetry/__init__.py", line 127, in wrapper
    return f(*args, **kwargs)
  File "/home/tomershm/miniconda3/envs/h2ogpt/lib/python3.10/site-packages/chromadb/api/segment.py", line 217, in get_or_create_collection
    return self.create_collection(  # type: ignore
  File "/home/tomershm/miniconda3/envs/h2ogpt/lib/python3.10/site-packages/chromadb/telemetry/opentelemetry/__init__.py", line 127, in wrapper
    return f(*args, **kwargs)
  File "/home/tomershm/miniconda3/envs/h2ogpt/lib/python3.10/site-packages/chromadb/api/segment.py", line 167, in create_collection
    coll, created = self._sysdb.create_collection(
  File "/home/tomershm/miniconda3/envs/h2ogpt/lib/python3.10/site-packages/chromadb/telemetry/opentelemetry/__init__.py", line 127, in wrapper
    return f(*args, **kwargs)
  File "/home/tomershm/miniconda3/envs/h2ogpt/lib/python3.10/site-packages/chromadb/db/mixins/sysdb.py", line 209, in create_collection
    existing = self.get_collections(name=name, tenant=tenant, database=database)
  File "/home/tomershm/miniconda3/envs/h2ogpt/lib/python3.10/site-packages/chromadb/telemetry/opentelemetry/__init__.py", line 127, in wrapper
    return f(*args, **kwargs)
  File "/home/tomershm/miniconda3/envs/h2ogpt/lib/python3.10/site-packages/chromadb/db/mixins/sysdb.py", line 435, in get_collections
    rows = cur.execute(sql, params).fetchall()
sqlite3.OperationalError: no such column: collections.topic

Versions

chroma 0.4.23 python 3.10.

A user of h2oGPT hit this, unsure why. Any ideas?

Relevant log output

No response

@pseudotensor pseudotensor added the bug Something isn't working label May 6, 2024
@MathiasToftas
Copy link

MathiasToftas commented May 7, 2024

I've also encountered this issue today when running a a script that worked the week before last.

I did some looking around at commits and I think I found the problem. The third party tool you are using is likely using an older version of chroma (something like 0.4.x) because the topic column was removed in the latest version of chroma 0.5.0 (see #1933)

So if you have a version mismatch (say a new instance of chromadb and an older script/tool using it) you will get this error

@tazarov
Copy link
Contributor

tazarov commented May 7, 2024

@pseudotensor, in 0.4.24, we phased out a column in the SQLite DB. The change is not backward compatible for clients. That means that if you have a DB created or accessed with 0.4.24, we apply a migration to the chroma.sqlite3 file, which is non-reversible, and any older client will give you the above exception.

@HammadB
Copy link
Collaborator

HammadB commented May 9, 2024

I think this is due to a version mismatch with 0.5. Can you confirm if that solves your issue ?

@aliyassine26
Copy link

aliyassine26 commented May 13, 2024

switching to 0.5 solves the issue

UPDATE: now I am facing this error when using collection.query

chromadb Exception: {"error":"AttributeError(\"type object 'QueryEmbedding' has no attribute 'model_validate'\")"}

@tazarov
Copy link
Contributor

tazarov commented May 14, 2024

@aliyassine26, this is due to an older version of pydantic. Can you bump your pydantic version to 2.x+

@Sayantanighosh17github
Copy link

I have a Chroma version: 0.4.22 , SQLite version: 3.42.0 , Python 3.11.9 still getting the issue
Exception has occurred: OperationalError
no such column: collections.topic
File "C:\Users\SayantaniGhosh\Documents\IBM24\GenAI_WatsonX_Usecase_DIAGEO\git_repo\test_bpmn_fiori\services\test1.py", line 34, in fetch_all_docs
db3 = Chroma(persist_directory="./db_manager/chroma_db_impact", embedding_function=embeddings1)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\SayantaniGhosh\Documents\IBM24\GenAI_WatsonX_Usecase_DIAGEO\git_repo\test_bpmn_fiori\services\test1.py", line 54, in
extracted_details_for_fiori_app = fetch_all_docs(fiori_app_names_list)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
sqlite3.OperationalError: no such column: collections.topic

@tazarov
Copy link
Contributor

tazarov commented May 19, 2024

@Sayantanighosh17github, this issue appears when you have accessed your Chroma persistent data with 0.5.0 version. Chroma does a schema migration from 0.4.x->0.5.x. To resolve start using Chroma 0.5.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants