Skip to content

Commit 84aa33c

Browse files
committed
using the connection object to begin connections
1 parent bb3e1f9 commit 84aa33c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

nettacker/database/db.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ def submit_report_to_db(event):
145145
connection, cursor = session
146146

147147
try:
148-
cursor.execute("BEGIN")
148+
connection.execute("BEGIN")
149149
cursor.execute(
150150
"""
151151
INSERT INTO reports (date, scan_unique_id, report_path_filename, options)
@@ -194,7 +194,7 @@ def remove_old_logs(options):
194194
connection, cursor = session
195195

196196
try:
197-
cursor.execute("BEGIN")
197+
connection.execute("BEGIN")
198198
cursor.execute(
199199
"""
200200
DELETE FROM scan_events
@@ -334,7 +334,7 @@ def submit_temp_logs_to_db(log):
334334
for _ in range(Config.settings.max_retries):
335335
try:
336336
if not connection.in_transaction:
337-
cursor.execute("BEGIN")
337+
connection.execute("BEGIN")
338338
cursor.execute(
339339
"""
340340
INSERT INTO temp_events (target, date, module_name, scan_unique_id, event_name, port, event, data)

0 commit comments

Comments
 (0)