diff --git a/src/DatabaseLibrary/assertion.py b/src/DatabaseLibrary/assertion.py
index e21523b..256fad5 100644
--- a/src/DatabaseLibrary/assertion.py
+++ b/src/DatabaseLibrary/assertion.py
@@ -58,7 +58,6 @@ def check_if_exists_in_database(
| @{parameters} | Create List | John |
| Check If Exists In Database | SELECT id FROM person WHERE first_name = %s | parameters=${parameters} |
"""
- logger.info(f"Executing : Check If Exists In Database | {selectStatement}")
if not self.query(selectStatement, sansTran, alias=alias, parameters=parameters):
raise AssertionError(
msg or f"Expected to have have at least one row, but got 0 rows from: '{selectStatement}'"
@@ -99,7 +98,6 @@ def check_if_not_exists_in_database(
| @{parameters} | Create List | John |
| Check If Not Exists In Database | SELECT id FROM person WHERE first_name = %s | parameters=${parameters} |
"""
- logger.info(f"Executing : Check If Not Exists In Database | {selectStatement}")
query_results = self.query(selectStatement, sansTran, alias=alias, parameters=parameters)
if query_results:
raise AssertionError(
@@ -140,7 +138,6 @@ def row_count_is_0(
| @{parameters} | Create List | John |
| Row Count is 0 | SELECT id FROM person WHERE first_name = %s | parameters=${parameters} |
"""
- logger.info(f"Executing : Row Count Is 0 | {selectStatement}")
num_rows = self.row_count(selectStatement, sansTran, alias=alias, parameters=parameters)
if num_rows > 0:
raise AssertionError(msg or f"Expected 0 rows, but {num_rows} were returned from: '{selectStatement}'")
@@ -179,7 +176,6 @@ def row_count_is_equal_to_x(
| @{parameters} | Create List | John |
| Row Count Is Equal To X | SELECT id FROM person WHERE first_name = %s | 0 | parameters=${parameters} |
"""
- logger.info(f"Executing : Row Count Is Equal To X | {selectStatement} | {numRows}")
num_rows = self.row_count(selectStatement, sansTran, alias=alias, parameters=parameters)
if num_rows != int(numRows.encode("ascii")):
raise AssertionError(
@@ -220,7 +216,6 @@ def row_count_is_greater_than_x(
| @{parameters} | Create List | John |
| Row Count Is Greater Than X | SELECT id FROM person WHERE first_name = %s | 0 | parameters=${parameters} |
"""
- logger.info(f"Executing : Row Count Is Greater Than X | {selectStatement} | {numRows}")
num_rows = self.row_count(selectStatement, sansTran, alias=alias, parameters=parameters)
if num_rows <= int(numRows.encode("ascii")):
raise AssertionError(
@@ -261,7 +256,6 @@ def row_count_is_less_than_x(
| @{parameters} | Create List | John |
| Row Count Is Less Than X | SELECT id FROM person WHERE first_name = %s | 5 | parameters=${parameters} |
"""
- logger.info(f"Executing : Row Count Is Less Than X | {selectStatement} | {numRows}")
num_rows = self.row_count(selectStatement, sansTran, alias=alias, parameters=parameters)
if num_rows >= int(numRows.encode("ascii")):
raise AssertionError(
@@ -305,7 +299,6 @@ def check_row_count(
| @{parameters} | Create List | John |
| Check Row Count | SELECT id FROM person WHERE first_name = %s | *equals* | 5 | parameters=${parameters} |
"""
- logger.info(f"Executing : Check Row Count | {selectStatement} | {assertion_operator} | {expected_value}")
check_ok = False
time_counter = 0
while not check_ok:
@@ -367,10 +360,6 @@ def check_query_result(
| @{parameters} | Create List | John |
| Check Query Result | SELECT first_name FROM person | *contains* | Allan | parameters=${parameters} |
"""
- logger.info(
- f"Executing : Check Query Results | {selectStatement} | {assertion_operator} | {expected_value} | row = {row} | col = {col} "
- )
-
check_ok = False
time_counter = 0
while not check_ok:
@@ -416,7 +405,6 @@ def table_must_exist(
| Table Must Exist | person | alias=my_alias |
| Table Must Exist | person | sansTran=True |
"""
- logger.info(f"Executing : Table Must Exist | {tableName}")
db_connection = self.connection_store.get_connection(alias)
if db_connection.module_name in ["cx_Oracle", "oracledb"]:
query = (
diff --git a/src/DatabaseLibrary/connection_manager.py b/src/DatabaseLibrary/connection_manager.py
index 18c042b..6c5cbba 100644
--- a/src/DatabaseLibrary/connection_manager.py
+++ b/src/DatabaseLibrary/connection_manager.py
@@ -419,7 +419,6 @@ def disconnect_from_database(self, error_if_no_connection: bool = False, alias:
| Disconnect From Database | # disconnects from current connection to the database |
| Disconnect From Database | alias=my_alias | # disconnects from current connection to the database |
"""
- logger.info("Executing : Disconnect From Database")
db_connection = self.connection_store.pop_connection(alias)
if db_connection is None:
log_msg = "No open database connection to close"
@@ -437,7 +436,6 @@ def disconnect_from_all_databases(self):
For example:
| Disconnect From All Databases | # Closes connections to all databases |
"""
- logger.info("Executing : Disconnect From All Databases")
for db_connection in self.connection_store:
db_connection.client.close()
self.connection_store.clear()
@@ -459,7 +457,6 @@ def set_auto_commit(self, autoCommit: bool = True, alias: Optional[str] = None):
| # Explicitly set the desired state
| Set Auto Commit | False
"""
- logger.info("Executing : Set Auto Commit")
db_connection = self.connection_store.get_connection(alias)
db_connection.client.autocommit = autoCommit
diff --git a/src/DatabaseLibrary/query.py b/src/DatabaseLibrary/query.py
index f6af06d..9be1245 100644
--- a/src/DatabaseLibrary/query.py
+++ b/src/DatabaseLibrary/query.py
@@ -86,7 +86,6 @@ def query(
cur = None
try:
cur = db_connection.client.cursor()
- logger.info(f"Executing : Query | {selectStatement} ")
self._execute_sql(cur, selectStatement, parameters=parameters)
all_rows = cur.fetchall()
col_names = [c[0] for c in cur.description]
@@ -127,7 +126,6 @@ def row_count(
cur = None
try:
cur = db_connection.client.cursor()
- logger.info(f"Executing : Row Count | {selectStatement}")
self._execute_sql(cur, selectStatement, parameters=parameters)
data = cur.fetchall()
col_names = [c[0] for c in cur.description]
@@ -181,7 +179,6 @@ def description(
cur = None
try:
cur = db_connection.client.cursor()
- logger.info("Executing : Description | {selectStatement}")
self._execute_sql(cur, selectStatement, parameters=parameters)
description = list(cur.description)
if sys.version_info[0] < 3:
@@ -211,7 +208,6 @@ def delete_all_rows_from_table(self, tableName: str, sansTran: bool = False, ali
query = f"DELETE FROM {tableName}"
try:
cur = db_connection.client.cursor()
- logger.info(f"Executing : Delete All Rows From Table | {query}")
result = self._execute_sql(cur, query)
if result is not None:
if not sansTran:
@@ -293,7 +289,6 @@ def execute_sql_script(
cur = None
try:
cur = db_connection.client.cursor()
- logger.info(f"Executing : Execute SQL Script | {sqlScriptFileName}")
if not split:
logger.info("Statements splitting disabled - pass entire script content to the database module")
self._execute_sql(cur, sql_file.read())
@@ -359,7 +354,6 @@ def execute_sql_script(
statements_to_execute.append(current_statement)
for statement in statements_to_execute:
- logger.info(f"Executing statement from script file: {statement}")
line_ends_with_proc_end = re.compile(r"(\s|;)" + proc_end_pattern.pattern + "$")
omit_semicolon = not line_ends_with_proc_end.search(statement.lower())
self._execute_sql(cur, statement, omit_semicolon)
@@ -406,7 +400,6 @@ def execute_sql_string(
cur = None
try:
cur = db_connection.client.cursor()
- logger.info(f"Executing : Execute SQL String | {sqlString}")
self._execute_sql(cur, sqlString, omit_trailing_semicolon=omitTrailingSemicolon, parameters=parameters)
if not sansTran:
db_connection.client.commit()
@@ -461,7 +454,6 @@ def call_stored_procedure(
spParams = []
cur = None
try:
- logger.info(f"Executing : Call Stored Procedure | {spName} | {spParams}")
if db_connection.module_name == "pymssql":
cur = db_connection.client.cursor(as_dict=False)
else:
@@ -593,10 +585,13 @@ def _execute_sql(
if omit_trailing_semicolon:
sql_statement = sql_statement.rstrip(";")
if parameters is None:
- logger.debug(f"Executing sql '{sql_statement}' without parameters")
+ logger.info(f'Executing sql:
{sql_statement}
', html=True)
return cur.execute(sql_statement)
else:
- logger.debug(f"Executing sql '{sql_statement}' with parameters: {parameters}")
+ logger.info(
+ f'Executing sql:
{sql_statement}
Parameters: {parameters}
',
+ html=True,
+ )
return cur.execute(sql_statement, parameters)
def _log_query_results(self, col_names, result_rows, log_head: Optional[int] = None):