summaryrefslogtreecommitdiff
path: root/rag
diff options
context:
space:
mode:
authorGustaf Rydholm <gustaf.rydholm@gmail.com>2024-04-05 18:31:48 +0200
committerGustaf Rydholm <gustaf.rydholm@gmail.com>2024-04-05 18:31:48 +0200
commitd3284ab957f359260c49ca002f80f93f4fcc06df (patch)
tree86920d9ab7ab2c0faaf839ace55077b761f18709 /rag
parent36bb9e4cd1f42ae6e60ed4e296beab0eb462f376 (diff)
Remove table chunk table from pg
Diffstat (limited to 'rag')
-rw-r--r--rag/db/documents.py43
1 files changed, 0 insertions, 43 deletions
diff --git a/rag/db/documents.py b/rag/db/documents.py
index 69ca19c..7d088da 100644
--- a/rag/db/documents.py
+++ b/rag/db/documents.py
@@ -6,10 +6,6 @@ import psycopg
from langchain_core.documents.base import Document
TABLES = """
-CREATE TABLE IF NOT EXISTS chunk (
- id serial PRIMARY KEY,
- data text);
-
CREATE TABLE IF NOT EXISTS document (
hash text PRIMARY KEY)
"""
@@ -57,42 +53,3 @@ class Documents:
)
self.conn.commit()
return exist is not None
-
- def add_chunks(self, chunks: List[Document]):
- data = [(chunk,) for chunk in chunks]
- with self.conn.cursor() as cur:
- cur.executemany(
- """
- INSERT INTO chunk
- (data) VALUES
- (%s)
- """,
- data,
- )
- self.conn.commit()
-
- def add_chunk(self, data: str):
- with self.conn.cursor() as cur:
- cur.execute(
- """
- INSERT INTO chunk
- (data) VALUES
- (%s)
- """,
- (data,),
- )
- self.conn.commit()
-
- def get_chunk(self, id: int):
- with self.conn.cursor() as cur:
- cur.execute(
- """
- SELECT * FROM chunk
- WHERE
- id = %s
- """,
- (str(id),),
- )
- chunk = cur.fetchone()
- self.conn.commit()
- return chunk