DE-Lib 0.0.41__py3-none-any.whl → 0.0.42__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.
- DE_Lib/DataBase/Oracle.py +17 -8
- DE_Lib/DataBase/SQLite.py +4 -1
- {de_lib-0.0.41.dist-info → de_lib-0.0.42.dist-info}/METADATA +1 -1
- {de_lib-0.0.41.dist-info → de_lib-0.0.42.dist-info}/RECORD +7 -7
- {de_lib-0.0.41.dist-info → de_lib-0.0.42.dist-info}/WHEEL +0 -0
- {de_lib-0.0.41.dist-info → de_lib-0.0.42.dist-info}/licenses/LICENCE +0 -0
- {de_lib-0.0.41.dist-info → de_lib-0.0.42.dist-info}/top_level.txt +0 -0
DE_Lib/DataBase/Oracle.py
CHANGED
@@ -2,6 +2,7 @@ import os
|
|
2
2
|
import cx_Oracle as ora
|
3
3
|
import oracledb as odb
|
4
4
|
import sqlalchemy as sqa
|
5
|
+
from sqlalchemy import create_engine, text
|
5
6
|
import json
|
6
7
|
|
7
8
|
from DE_Lib.Utils import Generic
|
@@ -71,7 +72,8 @@ class ORACLE:
|
|
71
72
|
__driver = conn["driver_library"].lower()
|
72
73
|
conn_cnn = f"""{conn["database"].lower()}+{__driver}://{conn["username"]}:{conn["password"]}@{__dnsName}"""
|
73
74
|
__engine = sqa.create_engine(conn_cnn)
|
74
|
-
|
75
|
+
with __engine.connect() as connection:
|
76
|
+
__conn = connection.execute(text("select 1 from dual"))
|
75
77
|
elif conn["driver_conexao"].upper() == "CX_ORACLE":
|
76
78
|
__conn = ora.connect(conn["username"], conn["password"], __dnsName, threaded=True)
|
77
79
|
elif conn["driver_conexao"].upper() == "ORACLEDB" or conn is None:
|
@@ -88,9 +90,12 @@ class ORACLE:
|
|
88
90
|
#endregion
|
89
91
|
except Exception as error:
|
90
92
|
msg = f"""{json.dumps(conn, indent=4).replace(conn["password"], "******")}\nFalha ao tentar se conectar com o banco de dados ORACLE (SqlAlchemy)\nException Error: {error} """
|
91
|
-
self.
|
93
|
+
self.__cnn = msg
|
94
|
+
self.__connection_is_valid = False
|
92
95
|
self.__database_error = msg
|
96
|
+
self.__database_driver = conn["driver_conexao"]
|
93
97
|
result = self._connection_is_valid
|
98
|
+
self.__nome_database = gen.nvl(conn["database"], "")
|
94
99
|
finally:
|
95
100
|
return result
|
96
101
|
|
@@ -166,16 +171,20 @@ class ORACLE:
|
|
166
171
|
dnsName = string_connect["instance"]
|
167
172
|
str_cnn = f"""{database.lower()}{driver}://{user}:{pwd}@{dnsName}"""
|
168
173
|
engine = sqa.create_engine(str_cnn)
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
+
with engine.connect() as connection:
|
175
|
+
result = connection.execute(text("Select 1 from dual"))
|
176
|
+
#result = engine.connect()
|
177
|
+
self._connection_is_valid = True
|
178
|
+
self._cnn = result
|
179
|
+
self.__database_error = f"""{json.dumps(string_connect, indent=4).replace(string_connect["password"], "******")}\nConexao bem sucedida!"""
|
180
|
+
self._nome_database = gen.nvl(string_connect["database"], "")
|
174
181
|
except Exception as error:
|
175
182
|
msg = f"""{json.dumps(string_connect, indent=4).replace(string_connect["password"], "******")}\nFalha ao tentar se conectar com o banco de dados ORACLE (SqlAlchemy)\nException Error: {error} """
|
176
|
-
result = msg
|
177
183
|
self._connection_is_valid = False
|
178
184
|
self.__database_error = msg
|
185
|
+
self._cnn = False
|
186
|
+
self._nome_database = gen.nvl(string_connect["database"], "")
|
187
|
+
result = self._cnn
|
179
188
|
finally:
|
180
189
|
return result
|
181
190
|
#endregion
|
DE_Lib/DataBase/SQLite.py
CHANGED
@@ -18,6 +18,7 @@ class SQLITE:
|
|
18
18
|
msg, result = None, True
|
19
19
|
try:
|
20
20
|
__file = os.path.join(conn["host"], conn["instance"])
|
21
|
+
__con = ""
|
21
22
|
if os.path.isfile(__file):
|
22
23
|
if "check_same_thread" in kwargs.keys():
|
23
24
|
__check_same_thread = kwargs.get("check_same_thread")
|
@@ -31,7 +32,7 @@ class SQLITE:
|
|
31
32
|
engine = sqa.create_engine(f"""sqlite:///{__file}""")
|
32
33
|
__conn = engine.connect()
|
33
34
|
else:
|
34
|
-
|
35
|
+
__conn = ""
|
35
36
|
# driver nativo sqlite
|
36
37
|
|
37
38
|
self._connection_is_valid = True
|
@@ -45,6 +46,8 @@ class SQLITE:
|
|
45
46
|
result = msg
|
46
47
|
self._connection_is_valid = False
|
47
48
|
self.__database_error = msg
|
49
|
+
self._nome_database = gen.nvl(conn["database"], "SQLite")
|
50
|
+
self.__database_driver = conn["driver_conexao"]
|
48
51
|
finally:
|
49
52
|
return result
|
50
53
|
|
@@ -7,12 +7,12 @@ DE_Lib/DataBase/Informix.py,sha256=jXqPggYu8PjGrqtxMHwlCsqF5rK03olas5yVMH0Ndkw,1
|
|
7
7
|
DE_Lib/DataBase/Metadata.py,sha256=j0iJm26Sf0QvsYpN61hfwkllyW2EOA2XoFnSzEo9plE,3274
|
8
8
|
DE_Lib/DataBase/MsSql.py,sha256=eszkLLtRwhZq0IPkApiBTjYqcs1hqwPizC8wfpC6Vrk,1668
|
9
9
|
DE_Lib/DataBase/MySql.py,sha256=SWLJMaB30EBqaz32xwMBbc3lnemDPpF2kkkf5umlL3k,2534
|
10
|
-
DE_Lib/DataBase/Oracle.py,sha256=
|
10
|
+
DE_Lib/DataBase/Oracle.py,sha256=EHZckkiMXZyQvMHAoPg-IoupSW4GvjOJsxnu-xRr3_Q,10239
|
11
11
|
DE_Lib/DataBase/OracleDDL.py,sha256=8PDTjR52Igtj-FyPQvFUBRjTlXB7crMNB8Xh5LncB_Q,3785
|
12
12
|
DE_Lib/DataBase/Postgres.py,sha256=lMb6sFGvjjuuq4D4k7zzEo7-NtyrC79VITeKQfoDO6U,1667
|
13
13
|
DE_Lib/DataBase/RedShift.py,sha256=ewPi8hxEhfuekBpMl-P1LWgSGfbqPKRpXfjtduCwOKc,1736
|
14
14
|
DE_Lib/DataBase/SQCipher.py,sha256=Bw7nq4tQdhM7ux0INF9PUymsIIjBEwMKcA1Un8orCE8,1625
|
15
|
-
DE_Lib/DataBase/SQLite.py,sha256=
|
15
|
+
DE_Lib/DataBase/SQLite.py,sha256=RBPcdi-0rKNQsznNv93jwseZKwFD3x5Hhk15-bYG53E,2537
|
16
16
|
DE_Lib/DataBase/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
17
17
|
DE_Lib/Files/Avro.py,sha256=hVXwoOSESHzWROBNYSDOu4myIrcRqSiPqGLRA40vJAk,527
|
18
18
|
DE_Lib/Files/Csv.py,sha256=8mpD2g4Ej2RHQvxMODEpBDbxMV5pWJ8dJHyO8YZchuk,2430
|
@@ -42,8 +42,8 @@ DE_Lib/Utils/Cipher/Gcm.py,sha256=fOuCVOyd4sGv389E91yqomujKTtFZu6CyhySrmQKVfY,23
|
|
42
42
|
DE_Lib/Utils/Cipher/Pbkdf2.py,sha256=hRkgf0Fo5hV1gLbWlFGFzhYYUjPEqgpB2R-pPw7N2F8,1210
|
43
43
|
DE_Lib/Utils/Cipher/Rsa.py,sha256=MYG1YsGuq-Q-MoF6pmeMD0TyxMTwt6tuUaLvXcmzQ2k,4126
|
44
44
|
DE_Lib/Utils/Cipher/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
45
|
-
de_lib-0.0.
|
46
|
-
de_lib-0.0.
|
47
|
-
de_lib-0.0.
|
48
|
-
de_lib-0.0.
|
49
|
-
de_lib-0.0.
|
45
|
+
de_lib-0.0.42.dist-info/licenses/LICENCE,sha256=Qv2ilebwoUtMJnRsZwRy729xS5JZQzLauJ0tQzkAkTA,1088
|
46
|
+
de_lib-0.0.42.dist-info/METADATA,sha256=DtJG-E84BooMce_631pF03EKJ-k2dO4b67_HmBacz6E,2315
|
47
|
+
de_lib-0.0.42.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
48
|
+
de_lib-0.0.42.dist-info/top_level.txt,sha256=yI9fdM_jkhCz_sykPZQbfeUbQ1FRMt-xjv9fJ6YZVLE,7
|
49
|
+
de_lib-0.0.42.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|