BlendMMM commited on
Commit
9d7d519
·
verified ·
1 Parent(s): 2b739f5

Upload Home.py

Browse files
Files changed (1) hide show
  1. Home.py +7 -2
Home.py CHANGED
@@ -342,7 +342,7 @@ def check_valid_name():
342
 
343
  def query_excecuter_postgres(
344
  query,
345
- db_path=r"db\imp_db.db",
346
  params=None,
347
  insert=True,
348
  insert_retrieve=False,
@@ -360,8 +360,13 @@ def query_excecuter_postgres(
360
 
361
  """
362
  try:
 
 
 
 
 
363
  # Establish connection to the SQLite database
364
- conn = sqlite3.connect(r"db\imp_db.db")
365
  except sqlite3.Error as e:
366
  st.warning(f"Unable to connect to the SQLite database: {e}")
367
  st.stop()
 
342
 
343
  def query_excecuter_postgres(
344
  query,
345
+ db_path=None,
346
  params=None,
347
  insert=True,
348
  insert_retrieve=False,
 
360
 
361
  """
362
  try:
363
+ # Construct a cross-platform path to the database
364
+ db_dir = os.path.join("db")
365
+ os.makedirs(db_dir, exist_ok=True) # Make sure the directory exists
366
+ db_path = os.path.join(db_dir, "imp_db.db")
367
+
368
  # Establish connection to the SQLite database
369
+ conn = sqlite3.connect(db_path)
370
  except sqlite3.Error as e:
371
  st.warning(f"Unable to connect to the SQLite database: {e}")
372
  st.stop()