deepkansara-123 commited on
Commit
f543e54
·
verified ·
1 Parent(s): 8c02eb3

Update database1.py

Browse files

one filed not requried

Files changed (1) hide show
  1. database1.py +5 -7
database1.py CHANGED
@@ -2,7 +2,7 @@ import sqlite3
2
  import json
3
 
4
  class create_db:
5
- def __init__(self, token, chunk_json1, filename, full_content):
6
  conn = sqlite3.connect('my_database.db')
7
  cursor = conn.cursor()
8
 
@@ -10,8 +10,7 @@ class create_db:
10
  CREATE TABLE IF NOT EXISTS token_data (
11
  token_id TEXT PRIMARY KEY,
12
  chunk_data TEXT,
13
- filename TEXT,
14
- full_content TEXT
15
  )
16
  """)
17
 
@@ -19,8 +18,8 @@ class create_db:
19
 
20
  try:
21
  cursor.execute(
22
- "INSERT INTO token_data (token_id, chunk_data, filename, full_content) VALUES (?, ?, ?, ?)",
23
- (token, chunk_json, filename, full_content)
24
  )
25
  conn.commit()
26
  print({"message": f"✅ {filename} uploaded and stored successfully"})
@@ -54,9 +53,8 @@ class create_db:
54
  if result:
55
  return {
56
  "token": result[0],
57
- "chunk_data":result[1],
58
  "filename": result[2],
59
- "full_content": result[3]
60
  }
61
  else:
62
  return {"error": "No matching record found for token or filename."}
 
2
  import json
3
 
4
  class create_db:
5
+ def __init__(self, token, chunk_json1, filename):
6
  conn = sqlite3.connect('my_database.db')
7
  cursor = conn.cursor()
8
 
 
10
  CREATE TABLE IF NOT EXISTS token_data (
11
  token_id TEXT PRIMARY KEY,
12
  chunk_data TEXT,
13
+ filename TEXT
 
14
  )
15
  """)
16
 
 
18
 
19
  try:
20
  cursor.execute(
21
+ "INSERT INTO token_data (token_id, chunk_data, filename) VALUES (?, ?, ?)",
22
+ (token, chunk_json, filename)
23
  )
24
  conn.commit()
25
  print({"message": f"✅ {filename} uploaded and stored successfully"})
 
53
  if result:
54
  return {
55
  "token": result[0],
56
+ "chunk_data": result[1],
57
  "filename": result[2],
 
58
  }
59
  else:
60
  return {"error": "No matching record found for token or filename."}