AI-ANK commited on
Commit
83242a5
·
verified ·
1 Parent(s): 2ebcbe2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -10
app.py CHANGED
@@ -29,8 +29,6 @@ from llama_index.query_engine.retriever_query_engine import (
29
  RetrieverQueryEngine,
30
  )
31
 
32
- from sqlalchemy import text, event
33
-
34
  st.set_page_config(layout="wide")
35
  write_dir = Path("textdata")
36
 
@@ -195,14 +193,6 @@ if st.button("Submit Query"):
195
  df2 = df.drop('text', axis=1)
196
  #Create a SQLite database and engine
197
  engine = create_engine("sqlite:///NY_House_Dataset.db?mode=ro", connect_args={"uri": True})
198
-
199
- @event.listens_for(engine, "before_cursor_execute")
200
- def receive_before_cursor_execute(conn, cursor, statement, params, context, executemany):
201
- if statement.strip().lower().startswith(("insert", "update", "delete")):
202
- # Instead of raising an error, log or print a warning
203
- print("Read-only mode: Modification attempt blocked.")
204
- # Prevent execution by skipping the operation
205
- raise Exception("Attempted to modify the database in read-only mode.")
206
 
207
  sql_database = SQLDatabase(engine)
208
  #Convert the DataFrame to a SQL table within the SQLite database
 
29
  RetrieverQueryEngine,
30
  )
31
 
 
 
32
  st.set_page_config(layout="wide")
33
  write_dir = Path("textdata")
34
 
 
193
  df2 = df.drop('text', axis=1)
194
  #Create a SQLite database and engine
195
  engine = create_engine("sqlite:///NY_House_Dataset.db?mode=ro", connect_args={"uri": True})
 
 
 
 
 
 
 
 
196
 
197
  sql_database = SQLDatabase(engine)
198
  #Convert the DataFrame to a SQL table within the SQLite database