Slight bug fix for the general purpose SQL SELECT function. Also adding more maps.

This commit is contained in:
Scott Idem
2024-07-31 19:33:10 -04:00
parent 5d599b28fe
commit b78d93a056
11 changed files with 655 additions and 110 deletions

View File

@@ -954,10 +954,10 @@ def run_sql_select(
# https://docs.sqlalchemy.org/en/13/core/sqlelement.html#sqlalchemy.sql.expression.TextClause.columns
# https://docs.sqlalchemy.org/en/13/core/type_basics.html
# Use the columns method to specify the data types for the columns. This may need to be done for other column names.
sql = sql.columns(recurring_start_time=Time, recurring_end_time=Time)
if commit:
trans = db.begin()
sql = sql.columns(recurring_start_time=Time, recurring_end_time=Time)
if data:
log.info('Executing with SQL statement and data...')
result = db.execute(sql, data)
@@ -990,12 +990,18 @@ def run_sql_select(
# db.engine.dispose()
log.info('Now trying the query again...')
try:
if commit:
trans = db.begin()
if data:
log.info('2x Executing with SQL statement and data...')
result = db.execute(sql, data)
else:
log.info('2x Executing with SQL statement only...')
result = db.execute(sql)
if commit:
trans.commit()
except Exception as e:
log.error('Tried again an exception was raised again. Not going to try again.')
log.exception('**** *** ** * ### BEGIN ### (2x) Second Exception Happened: Returning False * ** *** ****')