Samka1u commited on
Commit
2e6394e
·
verified ·
1 Parent(s): 63793bb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -3
app.py CHANGED
@@ -20,6 +20,7 @@ from sqlalchemy import (
20
  )
21
  engine = create_engine("sqlite:///agentDB.db")
22
  metadata_obj = MetaData()
 
23
 
24
  def load_rows():
25
  """
@@ -148,7 +149,6 @@ def table_description():
148
  Returns:
149
  table_description (String): The table's column names and their data types.
150
  """
151
- inspector = inspect(engine)
152
  try:
153
  columns_info = [(col["name"], col["type"]) for col in inspector.get_columns(PATHS.TABLE_NAME)]
154
  table_description = "Columns:\n" + "\n".join([f" - {name}: {col_type}" for name, col_type in columns_info])
@@ -165,7 +165,6 @@ def table_check()-> str:
165
  (String): A message containing table status.
166
  """
167
  try:
168
- inspector = inspect(engine)
169
  if inspector.has_table(PATHS.TABLE_NAME):
170
  return f"Table '{PATHS.TABLE_NAME}' exists."
171
  else:
@@ -290,7 +289,7 @@ def change_insert_mode(choice):
290
  """
291
  table_status = table_check()
292
  if choice == "Upload New" and not "NoSuchTableError" in table_status:
293
- sql_engine(f"DROP COLUMN *;")
294
  sql_engine(f"DROP TABLE {PATHS.TABLE_NAME};")
295
  else:
296
  pass
 
20
  )
21
  engine = create_engine("sqlite:///agentDB.db")
22
  metadata_obj = MetaData()
23
+ inspector = inspect(engine)
24
 
25
  def load_rows():
26
  """
 
149
  Returns:
150
  table_description (String): The table's column names and their data types.
151
  """
 
152
  try:
153
  columns_info = [(col["name"], col["type"]) for col in inspector.get_columns(PATHS.TABLE_NAME)]
154
  table_description = "Columns:\n" + "\n".join([f" - {name}: {col_type}" for name, col_type in columns_info])
 
165
  (String): A message containing table status.
166
  """
167
  try:
 
168
  if inspector.has_table(PATHS.TABLE_NAME):
169
  return f"Table '{PATHS.TABLE_NAME}' exists."
170
  else:
 
289
  """
290
  table_status = table_check()
291
  if choice == "Upload New" and not "NoSuchTableError" in table_status:
292
+ # sql_engine(f"DROP COLUMN *;")
293
  sql_engine(f"DROP TABLE {PATHS.TABLE_NAME};")
294
  else:
295
  pass