berryworld 1.0.0.180186__py3-none-any.whl → 1.0.0.181358__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 CHANGED
@@ -13,7 +13,8 @@ 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, **kwargs):
16
+ def __init__(self, server_creds=None, master=False, trusted_certificate=True,
17
+ multi_db=False, **kwargs):
17
18
  """ Initialize the class
18
19
  -----------------------------
19
20
  server_creds = {
@@ -30,11 +31,13 @@ class SQLConn:
30
31
  :param server_creds: Dictionary containing the info to connect to the Server
31
32
  :param master: Indicate whether the connection will be done to master or to a specific database
32
33
  :param trusted_certificate: Indicate whether the connection will be done using the TrustServerCertificate
34
+ :param multi_db: Indicate whether the connection will be done to a specific database or to multiple databases
33
35
  :param kwargs: Additional parameters to be passed to the connection
34
36
  """
35
37
  if (kwargs == {}) & (server_creds is None):
36
38
  raise ValueError('Please provide a valid server_creds or kwargs')
37
39
 
40
+ self.multi_db = multi_db
38
41
  self.master = master
39
42
  if trusted_certificate:
40
43
  self.trusted_certificate = '&TrustServerCertificate=yes'
@@ -80,12 +83,16 @@ class SQLConn:
80
83
  :param commit_as_transaction: Indicate whether the connection will be done using the autocommit option or not
81
84
  :return: The opened connection
82
85
  """
86
+ database = self.db_name
87
+ if self.multi_db:
88
+ database = str(self.db_name).lower().replace('primary;', '')
89
+
83
90
  if self.master:
84
91
  self.con_string = 'mssql+pyodbc://' + self.user_name + ':%s@' + self.server + '/master' + \
85
92
  '?driver=' + self.driver + '&trusted_connection=yes' + self.trusted_certificate
86
93
  self.engine = sa.create_engine(self.con_string % parse.quote_plus(self.password))
87
94
  else:
88
- self.con_string = 'mssql+pyodbc://' + self.user_name + ':%s@' + self.server + '/' + self.db_name + \
95
+ self.con_string = 'mssql+pyodbc://' + self.user_name + ':%s@' + self.server + '/' + database + \
89
96
  '?driver=' + self.driver + self.trusted_certificate
90
97
  self.engine = sa.create_engine(self.con_string % parse.quote_plus(self.password))
91
98
  if not commit_as_transaction:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: berryworld
3
- Version: 1.0.0.180186
3
+ Version: 1.0.0.181358
4
4
  Summary: Handy classes to improve ETL processes
5
5
  Home-page: https://www.berryworld.com
6
6
  Author: BerryWorld ltd
@@ -25,6 +25,8 @@ Requires-Dist: requests>=2.31.0
25
25
  Requires-Dist: scipy>=1.11.1
26
26
  Requires-Dist: setuptools>=61.2.0
27
27
  Requires-Dist: SQLAlchemy>=1.4.32
28
+ Requires-Dist: snowflake-connector-python>=3.12.2
29
+ Requires-Dist: snowflake>=0.12.1
28
30
  Requires-Dist: cffi>=1.15.1
29
31
  Requires-Dist: beautifulsoup4>=4.12.2
30
32
 
@@ -18,7 +18,7 @@ berryworld/postgres_connection.py,sha256=whKDnchd5Feqpmxpoh2vlyn36EKHR-dVEULYq0N
18
18
  berryworld/power_automate.py,sha256=9rDuRy0v-Ttq-SThid4lOB_tD4ibkyEmobiROpa--g4,25414
19
19
  berryworld/sharepoint_con.py,sha256=TuH-Vxk1VxjTi7x80KFssf_J8YPLRXpV27RBaFZi37U,22254
20
20
  berryworld/snowflake_conn.py,sha256=52ugfkyVCbR_Xr8YiZtNwPrwe93_1uE9uRy_VNPT6Gs,2428
21
- berryworld/sql_conn.py,sha256=meDAf_92hNW5Zp5sv_PPeIUA8NDchaDtVN7zo77veIA,47491
21
+ berryworld/sql_conn.py,sha256=3_uPrn3rJjVr7-9wcXkh0CSitFD2ncQGGZjttFl6ELM,47803
22
22
  berryworld/teams_logging.py,sha256=8NwXyWr4fLj7W6GzAm2nRQCGFDxibQpAHDHHD24FrP8,6997
23
23
  berryworld/transportation_solver.py,sha256=gdlHRgl2wlp5EV0uhKIOYtkkbAlHaFHGktnMgvuENWE,5022
24
24
  berryworld/verify_keys.py,sha256=J2J505PcmBsQ9bj0XSRtXjpY-8qwpPU1A5LQdFRicFU,4257
@@ -29,8 +29,8 @@ tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
29
29
  tests/test_allocation_config.py,sha256=e12l6fE9U57eSPS35g6ekJ_hol7-RHg89JV60_m1BlE,4633
30
30
  tests/test_handy_mix_config.py,sha256=Un56mz9KJmdn4K4OwzHAHLSRzDU1Xv2nFrONNuzOG04,2594
31
31
  tests/test_xml_parser.py,sha256=3QTlhFEd6KbK6nRFKZnc35tad6wqukTbe4QrFi8mr_8,859
32
- berryworld-1.0.0.180186.dist-info/LICENSE,sha256=vtkVCJM6E2af2gnsi2XxKPr4WY-uIbvzVLXieFND0UU,1074
33
- berryworld-1.0.0.180186.dist-info/METADATA,sha256=WG8XZhEMwI-ZlypqzwASDZFGbOFkKhi930Fc85mKuTA,1091
34
- berryworld-1.0.0.180186.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
35
- berryworld-1.0.0.180186.dist-info/top_level.txt,sha256=GIZ5qy-P5oxfEH755vA1IMFeTVdX3-40JxMe6nOe5I8,17
36
- berryworld-1.0.0.180186.dist-info/RECORD,,
32
+ berryworld-1.0.0.181358.dist-info/LICENSE,sha256=vtkVCJM6E2af2gnsi2XxKPr4WY-uIbvzVLXieFND0UU,1074
33
+ berryworld-1.0.0.181358.dist-info/METADATA,sha256=znF4x6wLc65ByBfuts_wxOdfDJYTrxRJgcsPbdFnwnc,1174
34
+ berryworld-1.0.0.181358.dist-info/WHEEL,sha256=OVMc5UfuAQiSplgO0_WdW7vXVGAt9Hdd6qtN4HotdyA,91
35
+ berryworld-1.0.0.181358.dist-info/top_level.txt,sha256=GIZ5qy-P5oxfEH755vA1IMFeTVdX3-40JxMe6nOe5I8,17
36
+ berryworld-1.0.0.181358.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.1.0)
2
+ Generator: setuptools (75.2.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5