berryworld 1.0.0.189413__py3-none-any.whl → 1.0.0.189823__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.
- berryworld/sql_conn.py +10 -4
- {berryworld-1.0.0.189413.dist-info → berryworld-1.0.0.189823.dist-info}/METADATA +1 -1
- {berryworld-1.0.0.189413.dist-info → berryworld-1.0.0.189823.dist-info}/RECORD +6 -6
- {berryworld-1.0.0.189413.dist-info → berryworld-1.0.0.189823.dist-info}/WHEEL +1 -1
- {berryworld-1.0.0.189413.dist-info → berryworld-1.0.0.189823.dist-info}/licenses/LICENSE +0 -0
- {berryworld-1.0.0.189413.dist-info → berryworld-1.0.0.189823.dist-info}/top_level.txt +0 -0
berryworld/sql_conn.py
CHANGED
|
@@ -13,7 +13,7 @@ from .credentials import SQLCredentials
|
|
|
13
13
|
class SQLConn:
|
|
14
14
|
""" Connect to Microsoft SQL """
|
|
15
15
|
|
|
16
|
-
def __init__(self, server_creds=None, master=False, trusted_certificate=True,
|
|
16
|
+
def __init__(self, server_creds=None, master=False, trusted_certificate=True, encrypt=True,
|
|
17
17
|
multi_db=False, **kwargs):
|
|
18
18
|
""" Initialize the class
|
|
19
19
|
-----------------------------
|
|
@@ -31,6 +31,7 @@ class SQLConn:
|
|
|
31
31
|
:param server_creds: Dictionary containing the info to connect to the Server
|
|
32
32
|
:param master: Indicate whether the connection will be done to master or to a specific database
|
|
33
33
|
:param trusted_certificate: Indicate whether the connection will be done using the TrustServerCertificate
|
|
34
|
+
:param encrypt: Indicate whether the connection will use SSL/TLS encryption
|
|
34
35
|
:param multi_db: Indicate whether the connection will be done to a specific database or to multiple databases
|
|
35
36
|
:param kwargs: Additional parameters to be passed to the connection
|
|
36
37
|
"""
|
|
@@ -43,6 +44,10 @@ class SQLConn:
|
|
|
43
44
|
self.trusted_certificate = '&TrustServerCertificate=yes'
|
|
44
45
|
else:
|
|
45
46
|
self.trusted_certificate = ''
|
|
47
|
+
if encrypt:
|
|
48
|
+
self.encrypt = '&Encrypt=yes'
|
|
49
|
+
else:
|
|
50
|
+
self.encrypt = ''
|
|
46
51
|
|
|
47
52
|
if kwargs != {}:
|
|
48
53
|
try:
|
|
@@ -89,11 +94,12 @@ class SQLConn:
|
|
|
89
94
|
|
|
90
95
|
if self.master:
|
|
91
96
|
self.con_string = 'mssql+pyodbc://' + self.user_name + ':%s@' + self.server + '/master' + \
|
|
92
|
-
'?driver=' + self.driver + '&trusted_connection=yes' + self.trusted_certificate
|
|
97
|
+
'?driver=' + self.driver + '&trusted_connection=yes' + self.trusted_certificate + \
|
|
98
|
+
self.encrypt
|
|
93
99
|
self.engine = sa.create_engine(self.con_string % parse.quote_plus(self.password))
|
|
94
100
|
else:
|
|
95
101
|
self.con_string = 'mssql+pyodbc://' + self.user_name + ':%s@' + self.server + '/' + database + \
|
|
96
|
-
'?driver=' + self.driver + self.trusted_certificate
|
|
102
|
+
'?driver=' + self.driver + self.trusted_certificate + self.encrypt
|
|
97
103
|
self.engine = sa.create_engine(self.con_string % parse.quote_plus(self.password))
|
|
98
104
|
if not commit_as_transaction:
|
|
99
105
|
self.engine = self.engine.execution_options(isolation_level="AUTOCOMMIT")
|
|
@@ -105,7 +111,7 @@ class SQLConn:
|
|
|
105
111
|
:return: The opened connection
|
|
106
112
|
"""
|
|
107
113
|
constring = 'mssql+pyodbc://' + self.user_name + ':%s@' + self.server + '/' + self.db_name + \
|
|
108
|
-
'?driver=' + self.driver + self.trusted_certificate
|
|
114
|
+
'?driver=' + self.driver + self.trusted_certificate + self.encrypt
|
|
109
115
|
self.engine = sa.create_engine(constring % parse.quote_plus(self.password))
|
|
110
116
|
if not commit_as_transaction:
|
|
111
117
|
self.engine = self.engine.execution_options(isolation_level="AUTOCOMMIT")
|
|
@@ -18,19 +18,19 @@ berryworld/pickle_management.py,sha256=5o6UuXBpTj23Jgpz6sj9V-vdcdWBK1xMEckWxT-Wh
|
|
|
18
18
|
berryworld/power_automate.py,sha256=V86QEGG9H36DrDvod9Q6yp8OUu307hfYcXJhw06pYrA,27912
|
|
19
19
|
berryworld/sharepoint_con.py,sha256=TuH-Vxk1VxjTi7x80KFssf_J8YPLRXpV27RBaFZi37U,22254
|
|
20
20
|
berryworld/snowflake_conn.py,sha256=go5ZJjnhz5SkG83B0G0XZSwKgU6tg7AFTBso59oRG5M,2434
|
|
21
|
-
berryworld/sql_conn.py,sha256=
|
|
21
|
+
berryworld/sql_conn.py,sha256=tYKgD8ja7NQuvLB1WBjdsJbPcm3eX1Y76QPTEgx8R8Q,47564
|
|
22
22
|
berryworld/teams_logging.py,sha256=8NwXyWr4fLj7W6GzAm2nRQCGFDxibQpAHDHHD24FrP8,6997
|
|
23
23
|
berryworld/transportation_solver.py,sha256=tNc1JJk71azIBccdWVHbqcvXWhalOdKffv6HmBD6tG0,5014
|
|
24
24
|
berryworld/verify_keys.py,sha256=X4Nuz3o0XbRDYofbJGvxIDeN5gfWj19PN7lhO6T3hR8,4356
|
|
25
25
|
berryworld/vivantio.py,sha256=QfZo0UKqkzVRg_LyiwivNd3aEup4TH57x4KxLZkCJwc,10627
|
|
26
26
|
berryworld/vivantio_logging.py,sha256=ciy7gA4u3FrgUIpEBnMgocbNPp6jcu9TPoy-kLcrTZU,5736
|
|
27
27
|
berryworld/xml_parser.py,sha256=HWD71NaTN3DaIOGT6Wzxs4CEsroFhGQwe9iPLIL80Co,957
|
|
28
|
-
berryworld-1.0.0.
|
|
28
|
+
berryworld-1.0.0.189823.dist-info/licenses/LICENSE,sha256=vtkVCJM6E2af2gnsi2XxKPr4WY-uIbvzVLXieFND0UU,1074
|
|
29
29
|
tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
30
30
|
tests/test_allocation_config.py,sha256=e12l6fE9U57eSPS35g6ekJ_hol7-RHg89JV60_m1BlE,4633
|
|
31
31
|
tests/test_handy_mix_config.py,sha256=Un56mz9KJmdn4K4OwzHAHLSRzDU1Xv2nFrONNuzOG04,2594
|
|
32
32
|
tests/test_xml_parser.py,sha256=3QTlhFEd6KbK6nRFKZnc35tad6wqukTbe4QrFi8mr_8,859
|
|
33
|
-
berryworld-1.0.0.
|
|
34
|
-
berryworld-1.0.0.
|
|
35
|
-
berryworld-1.0.0.
|
|
36
|
-
berryworld-1.0.0.
|
|
33
|
+
berryworld-1.0.0.189823.dist-info/METADATA,sha256=0VIdQ1tBiCaDM3CHc3tHB7_jhAgG4h_EsZY0tFSaEVQ,1362
|
|
34
|
+
berryworld-1.0.0.189823.dist-info/WHEEL,sha256=0CuiUZ_p9E4cD6NyLD6UG80LBXYyiSYZOKDm5lp32xk,91
|
|
35
|
+
berryworld-1.0.0.189823.dist-info/top_level.txt,sha256=GIZ5qy-P5oxfEH755vA1IMFeTVdX3-40JxMe6nOe5I8,17
|
|
36
|
+
berryworld-1.0.0.189823.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|