agenthink 0.1.16__py3-none-any.whl → 0.1.18__py3-none-any.whl
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.
- agenthink/connection.py +30 -19
- {agenthink-0.1.16.dist-info → agenthink-0.1.18.dist-info}/METADATA +1 -1
- agenthink-0.1.18.dist-info/RECORD +8 -0
- agenthink-0.1.16.dist-info/RECORD +0 -8
- {agenthink-0.1.16.dist-info → agenthink-0.1.18.dist-info}/WHEEL +0 -0
- {agenthink-0.1.16.dist-info → agenthink-0.1.18.dist-info}/top_level.txt +0 -0
agenthink/connection.py
CHANGED
|
@@ -21,13 +21,17 @@ import re
|
|
|
21
21
|
dotenv.load_dotenv()
|
|
22
22
|
|
|
23
23
|
# Create and configure logger
|
|
24
|
-
logging.basicConfig(
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
)
|
|
24
|
+
# logging.basicConfig(
|
|
25
|
+
# filename="datastore_library.log",
|
|
26
|
+
# format='%(asctime)s %(levelname)s:%(name)s:%(message)s',
|
|
27
|
+
# filemode='w'
|
|
28
|
+
# )
|
|
29
|
+
# logger = logging.getLogger(__name__)
|
|
30
|
+
# logger.setLevel(logging.DEBUG)
|
|
31
|
+
|
|
29
32
|
logger = logging.getLogger(__name__)
|
|
30
|
-
logger.
|
|
33
|
+
logger.addHandler(logging.NullHandler())
|
|
34
|
+
|
|
31
35
|
|
|
32
36
|
|
|
33
37
|
class DBConnector:
|
|
@@ -53,6 +57,12 @@ class DBConnector:
|
|
|
53
57
|
f"EndpointSuffix=core.windows.net"
|
|
54
58
|
)
|
|
55
59
|
|
|
60
|
+
logger.debug("DEBUG TEST: debug level log")
|
|
61
|
+
logger.info("INFO TEST: info level log")
|
|
62
|
+
logger.warning("WARNING TEST: warning level log")
|
|
63
|
+
logger.error("ERROR TEST: error level log")
|
|
64
|
+
|
|
65
|
+
|
|
56
66
|
try:
|
|
57
67
|
blob_service = BlobServiceClient.from_connection_string(connection_str)
|
|
58
68
|
self.__container_client = blob_service.get_container_client(self.__container_name)
|
|
@@ -242,18 +252,19 @@ class DBConnector:
|
|
|
242
252
|
return None
|
|
243
253
|
|
|
244
254
|
if database_type == "mysql":
|
|
245
|
-
try:
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
255
|
+
# try:
|
|
256
|
+
cursor = database_connection.cursor()
|
|
257
|
+
cursor.execute(query)
|
|
258
|
+
results = cursor.fetchall()
|
|
259
|
+
logger.info("Executed query on MySQL database '%s': %s", db_name, query)
|
|
260
|
+
# return f"{results}"
|
|
261
|
+
return f"{cursor}, {results}"
|
|
262
|
+
# except Exception as e:
|
|
263
|
+
# logger.exception("Failed to execute query on MySQL database '%s': %s", db_name, e)
|
|
264
|
+
# return None
|
|
265
|
+
# finally:
|
|
266
|
+
# if cursor:
|
|
267
|
+
# cursor.close()
|
|
257
268
|
elif database_type == "mssql":
|
|
258
269
|
try:
|
|
259
270
|
cursor = database_connection.cursor()
|
|
@@ -273,7 +284,7 @@ class DBConnector:
|
|
|
273
284
|
logger.error("Unsupported database type '%s' for database '%s'", database_type, db_name)
|
|
274
285
|
return None
|
|
275
286
|
|
|
276
|
-
def
|
|
287
|
+
def _debugging_function(self):
|
|
277
288
|
prefix = f"{self._workflow_id}/{self._user_id}/"
|
|
278
289
|
all_blob_list = self.__container_client.list_blobs(name_starts_with=prefix)
|
|
279
290
|
output_message = f"""Debugging function executed. Current connections:\n
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
agenthink/__init__.py,sha256=6oUldrZgE76j8OhwsQgVY5vdaPTDFyChOljske-so8U,78
|
|
2
|
+
agenthink/connection.py,sha256=ngnRP-5qrIssl8Xeib0aD9yHUuDiC0WWaQcKRax6mfc,13108
|
|
3
|
+
agenthink/models.py,sha256=PhXEMmfU31MTt1IwXxXV9DVPl5PLroQFHjRgRDs8iTo,251
|
|
4
|
+
agenthink/utils.py,sha256=r5o74RbenFhQ7E3N7naoLJ-fYEe9otz0nkcvwKHDTaU,911
|
|
5
|
+
agenthink-0.1.18.dist-info/METADATA,sha256=Qj9Eg1TtdoE5JpU8zXgdFhnmy0caMtHq601rj1kXKJk,1722
|
|
6
|
+
agenthink-0.1.18.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
7
|
+
agenthink-0.1.18.dist-info/top_level.txt,sha256=rYw4Lx2uqOzbGCSoJEaikme7vS9NvgbVMc26QUIZoZM,10
|
|
8
|
+
agenthink-0.1.18.dist-info/RECORD,,
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
agenthink/__init__.py,sha256=6oUldrZgE76j8OhwsQgVY5vdaPTDFyChOljske-so8U,78
|
|
2
|
-
agenthink/connection.py,sha256=dqBbFuizCoIKDTD46F1Q6_80gjdewAyhadDs5BMOvAk,12753
|
|
3
|
-
agenthink/models.py,sha256=PhXEMmfU31MTt1IwXxXV9DVPl5PLroQFHjRgRDs8iTo,251
|
|
4
|
-
agenthink/utils.py,sha256=r5o74RbenFhQ7E3N7naoLJ-fYEe9otz0nkcvwKHDTaU,911
|
|
5
|
-
agenthink-0.1.16.dist-info/METADATA,sha256=HOBaS-Julyhax98k0hjyVlXpapmiryAUZhOsYywLIHM,1722
|
|
6
|
-
agenthink-0.1.16.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
7
|
-
agenthink-0.1.16.dist-info/top_level.txt,sha256=rYw4Lx2uqOzbGCSoJEaikme7vS9NvgbVMc26QUIZoZM,10
|
|
8
|
-
agenthink-0.1.16.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|