mirror of
https://github.com/aljazceru/hummingbot-dashboard.git
synced 2026-01-01 12:34:24 +01:00
(fix) correct sql query
This commit is contained in:
@@ -14,6 +14,20 @@ class OptunaDBManager:
|
||||
self.engine = create_engine(self.db_path, connect_args={'check_same_thread': False})
|
||||
self.session_maker = sessionmaker(bind=self.engine)
|
||||
|
||||
@property
|
||||
def status(self):
|
||||
try:
|
||||
with self.session_maker() as session:
|
||||
query = 'SELECT * FROM trials WHERE state = "COMPLETE"'
|
||||
completed_trials = pd.read_sql_query(query, session.connection())
|
||||
if len(completed_trials) > 0:
|
||||
# TODO: improve error handling, think what to do with other cases
|
||||
return "OK"
|
||||
else:
|
||||
return "No records found in the trials table with completed state"
|
||||
except Exception as e:
|
||||
return f"Error: {str(e)}"
|
||||
|
||||
@property
|
||||
def tables(self):
|
||||
return self._get_tables()
|
||||
|
||||
Reference in New Issue
Block a user