Skip to content

Commit cda16a8

Browse files
Added version of execute sql string without transaction wrapper.
1 parent 1745a56 commit cda16a8

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

src/DatabaseLibrary/query.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,24 @@ def execute_sql_string(self, sqlString):
268268
if cur:
269269
self._dbconnection.rollback()
270270

271+
def execute_sql_string_sanstran(self, sqlString):
272+
"""
273+
Executes the sqlString as SQL commands.
274+
Useful to pass arguments to your sql.
275+
Does not wrap execution in transaction!
276+
277+
SQL commands are expected to be delimited by a semi-colon (';').
278+
279+
For example:
280+
| Execute Sql String Sanstran | DELETE FROM person_employee_table; DELETE FROM person_table |
281+
282+
For example with an argument:
283+
| Execute Sql String Sanstran | SELECT * FROM person WHERE first_name = ${FIRSTNAME} |
284+
"""
285+
cur = self._dbconnection.cursor()
286+
logger.info('Executing : Execute SQL String Sanstran | %s ' % (sqlString))
287+
self.__execute_sql(cur, sqlString)
288+
271289
def call_stored_procedure(self, spName, spParams=None):
272290
"""
273291
Uses the inputs of `spName` and 'spParams' to call a stored procedure

0 commit comments

Comments
 (0)