Day 2, full DB import/update/delete from dir with XML or HTTP
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from traceback import format_exc
|
||||
|
||||
|
||||
class DBImpl:
|
||||
def __init__(self, engine, params):
|
||||
@@ -19,6 +21,15 @@ class DBImpl:
|
||||
def get_cursor(self):
|
||||
return self.connection.cursor()
|
||||
|
||||
def execute(self, sql_query):
|
||||
try:
|
||||
cur = self.get_cursor()
|
||||
cur.execute(sql_query)
|
||||
self.transaction_commit()
|
||||
except:
|
||||
self.transaction_rollback()
|
||||
raise BaseException("Error execute sql query. Reason : {}".format(format_exc()))
|
||||
|
||||
def get_rows(self, query_string, for_dict=True):
|
||||
if for_dict:
|
||||
cur = self.connection.cursor(self.db_engine.cursors.DictCursor)
|
||||
|
||||
Reference in New Issue
Block a user