dbhydra 2.2.11__tar.gz → 2.2.13__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {dbhydra-2.2.11 → dbhydra-2.2.13}/PKG-INFO +1 -1
- {dbhydra-2.2.11 → dbhydra-2.2.13}/dbhydra/src/abstract_db.py +12 -6
- {dbhydra-2.2.11 → dbhydra-2.2.13}/dbhydra/src/mysql_db.py +4 -2
- {dbhydra-2.2.11 → dbhydra-2.2.13}/dbhydra.egg-info/PKG-INFO +1 -1
- {dbhydra-2.2.11 → dbhydra-2.2.13}/setup.py +1 -1
- {dbhydra-2.2.11 → dbhydra-2.2.13}/LICENSE +0 -0
- {dbhydra-2.2.11 → dbhydra-2.2.13}/README.md +0 -0
- {dbhydra-2.2.11 → dbhydra-2.2.13}/dbhydra/__init__.py +0 -0
- {dbhydra-2.2.11 → dbhydra-2.2.13}/dbhydra/dbhydra_core.py +0 -0
- {dbhydra-2.2.11 → dbhydra-2.2.13}/dbhydra/src/__init__.py +0 -0
- {dbhydra-2.2.11 → dbhydra-2.2.13}/dbhydra/src/abstract_table.py +0 -0
- {dbhydra-2.2.11 → dbhydra-2.2.13}/dbhydra/src/bigquery_db.py +0 -0
- {dbhydra-2.2.11 → dbhydra-2.2.13}/dbhydra/src/errors/__init__.py +0 -0
- {dbhydra-2.2.11 → dbhydra-2.2.13}/dbhydra/src/errors/exceptions.py +0 -0
- {dbhydra-2.2.11 → dbhydra-2.2.13}/dbhydra/src/migrator.py +0 -0
- {dbhydra-2.2.11 → dbhydra-2.2.13}/dbhydra/src/mongo_db.py +0 -0
- {dbhydra-2.2.11 → dbhydra-2.2.13}/dbhydra/src/postgres_db.py +0 -0
- {dbhydra-2.2.11 → dbhydra-2.2.13}/dbhydra/src/sqlserver_db.py +0 -0
- {dbhydra-2.2.11 → dbhydra-2.2.13}/dbhydra/src/tables.py +0 -0
- {dbhydra-2.2.11 → dbhydra-2.2.13}/dbhydra/src/xlsx_db.py +0 -0
- {dbhydra-2.2.11 → dbhydra-2.2.13}/dbhydra/test_migrator.py +0 -0
- {dbhydra-2.2.11 → dbhydra-2.2.13}/dbhydra/tests/__init__.py +0 -0
- {dbhydra-2.2.11 → dbhydra-2.2.13}/dbhydra/tests/test_cases.py +0 -0
- {dbhydra-2.2.11 → dbhydra-2.2.13}/dbhydra/tests/test_mongo.py +0 -0
- {dbhydra-2.2.11 → dbhydra-2.2.13}/dbhydra/tests/test_sql.py +0 -0
- {dbhydra-2.2.11 → dbhydra-2.2.13}/dbhydra.egg-info/SOURCES.txt +0 -0
- {dbhydra-2.2.11 → dbhydra-2.2.13}/dbhydra.egg-info/dependency_links.txt +0 -0
- {dbhydra-2.2.11 → dbhydra-2.2.13}/dbhydra.egg-info/requires.txt +0 -0
- {dbhydra-2.2.11 → dbhydra-2.2.13}/dbhydra.egg-info/top_level.txt +0 -0
- {dbhydra-2.2.11 → dbhydra-2.2.13}/setup.cfg +0 -0
|
@@ -2,7 +2,7 @@ import abc
|
|
|
2
2
|
import threading
|
|
3
3
|
from contextlib import contextmanager
|
|
4
4
|
from typing import Optional
|
|
5
|
-
import
|
|
5
|
+
import datetime
|
|
6
6
|
from dbhydra.src.migrator import Migrator
|
|
7
7
|
from dbhydra.src.tables import AbstractTable
|
|
8
8
|
|
|
@@ -156,13 +156,13 @@ class AbstractDb(abc.ABC):
|
|
|
156
156
|
try:
|
|
157
157
|
if self.debug_mode:
|
|
158
158
|
with open("dbhydra_logs.txt","a+") as file:
|
|
159
|
-
file.write(str(
|
|
159
|
+
file.write(str(datetime.datetime.now())+": DB "+str(self)+": _connect() called\n")
|
|
160
160
|
self._connect()
|
|
161
161
|
yield None
|
|
162
162
|
finally:
|
|
163
163
|
if self.debug_mode:
|
|
164
164
|
with open("dbhydra_logs.txt","a+") as file:
|
|
165
|
-
file.write(str(
|
|
165
|
+
file.write(str(datetime.datetime.now())+": DB "+str(self)+": close_connection() called\n")
|
|
166
166
|
self.close_connection()
|
|
167
167
|
|
|
168
168
|
@contextmanager
|
|
@@ -197,12 +197,18 @@ class AbstractDb(abc.ABC):
|
|
|
197
197
|
self.cursor.commit()
|
|
198
198
|
if self.debug_mode:
|
|
199
199
|
with open("dbhydra_logs.txt","a+") as file:
|
|
200
|
-
file.write(str(
|
|
200
|
+
file.write(str(datetime.datetime.now())+": DB "+str(self)+": execute() called\n")
|
|
201
|
+
with open("dbhydra_queries_logs.txt","a+") as file:
|
|
202
|
+
file.write(str(datetime.datetime.now())+": "+str(query)+"\n")
|
|
201
203
|
return(result)
|
|
202
204
|
|
|
203
205
|
def close_connection(self):
|
|
204
|
-
|
|
205
|
-
|
|
206
|
+
try:
|
|
207
|
+
self.connection.close()
|
|
208
|
+
print("DB connection closed")
|
|
209
|
+
except AttributeError as e:
|
|
210
|
+
raise Exception("DbHydra Error: The connection couldn't be closed, are you sure the connection string to DB is configured correctly? Error message:"+str(e))
|
|
211
|
+
|
|
206
212
|
|
|
207
213
|
def initialize_migrator(self):
|
|
208
214
|
self.migrator = Migrator(self)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import datetime
|
|
4
4
|
import pymysql
|
|
5
5
|
from dbhydra.src.abstract_db import AbstractDb
|
|
6
6
|
from dbhydra.src.tables import MysqlTable
|
|
@@ -57,7 +57,9 @@ class MysqlDb(AbstractDb):
|
|
|
57
57
|
self.connection.commit()
|
|
58
58
|
if self.debug_mode:
|
|
59
59
|
with open("dbhydra_logs.txt","a+") as file:
|
|
60
|
-
file.write(str(
|
|
60
|
+
file.write(str(datetime.datetime.now())+": DB "+str(self)+": execute() called\n")
|
|
61
|
+
with open("dbhydra_queries_logs.txt","a+") as file:
|
|
62
|
+
file.write(str(datetime.datetime.now())+": "+str(query)+"\n")
|
|
61
63
|
return result
|
|
62
64
|
|
|
63
65
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|