From d3284ab957f359260c49ca002f80f93f4fcc06df Mon Sep 17 00:00:00 2001 From: Gustaf Rydholm Date: Fri, 5 Apr 2024 18:31:48 +0200 Subject: Remove table chunk table from pg --- rag/db/documents.py | 43 ------------------------------------------- 1 file changed, 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 -- cgit v1.2.3-70-g09d2