added users administration tool
This commit is contained in:
Binary file not shown.
@@ -6,6 +6,11 @@ BASE_DIR = Path(__file__).resolve().parent
|
||||
# DB_PATH = BASE_DIR / "app_db" / "app.db"
|
||||
DB_PATH = BASE_DIR / "app.db"
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------------
|
||||
# Allgemeine Datenbankfunktionen
|
||||
#-------------------------------------------------------------------------------------
|
||||
|
||||
def get_conn():
|
||||
# check_same_thread=False, damit Streamlit mehrere Threads nutzen kann
|
||||
return sqlite3.connect(DB_PATH, check_same_thread=False)
|
||||
@@ -16,3 +21,18 @@ def get_list(sql, params=None):
|
||||
conn.close()
|
||||
return df
|
||||
|
||||
def send_cmd(sql, params=None):
|
||||
try:
|
||||
with get_conn() as conn:
|
||||
if params is None:
|
||||
conn.execute(sql)
|
||||
else:
|
||||
conn.execute(sql, params)
|
||||
return True
|
||||
except Exception as e:
|
||||
print("DB-Fehler:", e)
|
||||
return False
|
||||
|
||||
#-------------------------------------------------------------------------------------
|
||||
#
|
||||
#-------------------------------------------------------------------------------------
|
||||
Reference in New Issue
Block a user