remove raw_sql and pandas (#902)

This is technically a breaking change since we remove the endpoint for
`raw_sql`. `raw_sql` was an undocumented internal tool so we should
discuss how we want to handle this.
This commit is contained in:
Jeff Huber
2023-07-28 14:11:58 -07:00
committed by GitHub
parent ac26e789e8
commit dabc2e684c
9 changed files with 0 additions and 47 deletions

View File

@@ -1,6 +1,5 @@
from abc import ABC, abstractmethod
from typing import Sequence, Optional
import pandas as pd
from uuid import UUID
from chromadb.api.models.Collection import Collection
from chromadb.api.types import (
@@ -364,18 +363,6 @@ class API(Component, ABC):
"""
pass
@abstractmethod
def raw_sql(self, sql: str) -> pd.DataFrame:
"""Runs a raw SQL query against the database
Args:
sql: The SQL query to run
Returns:
pd.DataFrame: A pandas dataframe containing the results of the query
"""
pass
@abstractmethod
def create_index(self, collection_name: str) -> bool:
"""Creates an index for the given collection

View File

@@ -15,7 +15,6 @@ from chromadb.api.types import (
CollectionMetadata,
)
import chromadb.utils.embedding_functions as ef
import pandas as pd
import requests
import json
from typing import Sequence
@@ -355,15 +354,6 @@ class FastAPI(API):
raise_chroma_error(resp)
return cast(bool, resp.json())
@override
def raw_sql(self, sql: str) -> pd.DataFrame:
"""Runs a raw SQL query against the database"""
resp = self._session.post(
self._api_url + "/raw_sql", data=json.dumps({"raw_sql": sql})
)
raise_chroma_error(resp)
return pd.DataFrame.from_dict(resp.json())
@override
def create_index(self, collection_name: str) -> bool:
"""Soon deprecated"""

View File

@@ -34,7 +34,6 @@ import chromadb.types as t
from typing import Optional, Sequence, Generator, List, cast, Set, Dict
from overrides import override
from uuid import UUID, uuid4
import pandas as pd
import time
import logging
import re
@@ -494,10 +493,6 @@ class SegmentAPI(API):
self._system.reset_state()
return True
@override
def raw_sql(self, sql: str) -> pd.DataFrame:
raise NotImplementedError()
@override
def create_index(self, collection_name: str) -> bool:
logger.warning(

View File

@@ -122,10 +122,6 @@ class DB(Component):
) -> Sequence: # type: ignore
pass
@abstractmethod
def raw_sql(self, raw_sql): # type: ignore
pass
@abstractmethod
def create_index(self, collection_uuid: UUID): # type: ignore
pass

View File

@@ -8,7 +8,6 @@ from fastapi.routing import APIRoute
from fastapi import HTTPException, status
from uuid import UUID
import pandas as pd
import chromadb
from chromadb.api.models.Collection import Collection
@@ -26,7 +25,6 @@ from chromadb.server.fastapi.types import (
DeleteEmbedding,
GetEmbedding,
QueryEmbedding,
RawSql, # Results,
CreateCollection,
UpdateCollection,
UpdateEmbedding,
@@ -92,9 +90,6 @@ class FastAPI(chromadb.server.Server):
self.router.add_api_route("/api/v1/reset", self.reset, methods=["POST"])
self.router.add_api_route("/api/v1/version", self.version, methods=["GET"])
self.router.add_api_route("/api/v1/heartbeat", self.heartbeat, methods=["GET"])
self.router.add_api_route(
"/api/v1/raw_sql", self.raw_sql, methods=["POST"], response_model=None
)
self.router.add_api_route(
"/api/v1/collections",
@@ -290,8 +285,5 @@ class FastAPI(chromadb.server.Server):
)
return nnresult
def raw_sql(self, raw_sql: RawSql) -> pd.DataFrame:
return self._api.raw_sql(raw_sql.raw_sql)
def create_index(self, collection_name: str) -> bool:
return self._api.create_index(collection_name)

View File

@@ -46,10 +46,6 @@ class GetEmbedding(BaseModel): # type: ignore
include: Include = ["metadatas", "documents"]
class RawSql(BaseModel): # type: ignore
raw_sql: str
class DeleteEmbedding(BaseModel): # type: ignore
ids: Optional[List[str]] = None
where: Optional[Dict[Any, Any]] = None

View File

@@ -15,7 +15,6 @@ classifiers = [
"Operating System :: OS Independent",
]
dependencies = [
'pandas >= 1.3',
'requests >= 2.28',
'pydantic >= 1.9',
'numpy >= 1.21.6',

View File

@@ -15,7 +15,6 @@ classifiers = [
"Operating System :: OS Independent",
]
dependencies = [
'pandas >= 1.3',
'requests >= 2.28',
'pydantic>=1.9,<2.0',
'chroma-hnswlib==0.7.2',

View File

@@ -5,7 +5,6 @@ importlib-resources
numpy==1.21.6
onnxruntime==1.14.1
overrides==7.3.1
pandas==1.3.5
posthog==2.4.0
pulsar-client==3.1.0
pydantic>=1.9,<2.0