berryworld 1.0.0.158880__py3-none-any.whl → 1.0.0.161179__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.
@@ -71,8 +71,20 @@ class Postgresql:
71
71
  self.conn = psycopg2.connect(self.conn_str)
72
72
 
73
73
  def close(self):
74
- """ Close the connection to Postgresql """
75
- self.conn.close()
74
+ """ Close the connection to Postgresql and older opened connections """
75
+ try:
76
+ cursor = self.conn.cursor()
77
+ cursor.execute(
78
+ f''' SELECT pg_terminate_backend(pid) FROM pg_stat_activity
79
+ WHERE datname = '{self.db}' AND state = 'idle' AND pid <> pg_backend_pid()
80
+ AND backend_start < NOW() - INTERVAL '5 MINUTE'; '''
81
+ )
82
+ self.conn.commit()
83
+ cursor.close()
84
+ except Exception as e:
85
+ raise Exception(e)
86
+ finally:
87
+ self.conn.close()
76
88
 
77
89
  @staticmethod
78
90
  def _chunker(seq, size):
@@ -131,8 +143,6 @@ class Postgresql:
131
143
  cursor = self.conn.cursor()
132
144
  cursor.execute(statement)
133
145
  self.conn.commit()
134
- count = cursor.rowcount
135
- print(count, "Rows affected")
136
146
  except Exception as e:
137
147
  raise Exception(e)
138
148
  finally:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: berryworld
3
- Version: 1.0.0.158880
3
+ Version: 1.0.0.161179
4
4
  Summary: Handy classes to improve ETL processes
5
5
  Home-page: https://www.berryworld.com
6
6
  Author: BerryWorld ltd
@@ -13,7 +13,7 @@ berryworld/handy_mix.py,sha256=SLCAdl2xaWEewWkECzcVFUDODDEkvUgpmJjTiccyVwU,9771
13
13
  berryworld/microsoft_teams.py,sha256=xxvm8by80ay-jR2zxpiFc-TrK4R7uSI7mAr4gaCDKMk,15982
14
14
  berryworld/persistent_storage.py,sha256=_lGdXa7IyxfMF3xNF9y26X_z9RDb2Ah7R0oF61HR8Gc,5764
15
15
  berryworld/pickle_management.py,sha256=O49ojVtTqYCT510rVRTbZWWaur_-5q3HSVG03Azn8mQ,2393
16
- berryworld/postgres_connection.py,sha256=KAx4nbrgKGMgXsqL3-uu0EqGC4CL0BaW7SpUJRSjHEE,8365
16
+ berryworld/postgres_connection.py,sha256=D3qKX8vnrBXFhTyiD46La6foEgrYrcY0jFkJnvel_GU,8788
17
17
  berryworld/power_automate.py,sha256=r1eWB09rxn_HSNNCltaru6zI4inA-0aZcpdsDkLGYQc,18392
18
18
  berryworld/sharepoint_con.py,sha256=72CZSVpAoHxocAWFuSSeUkNHa4Vu8FdM09NX-QC5-eE,22011
19
19
  berryworld/sql_conn.py,sha256=_q7FSrVHUuNWmqLjMR4is2o9Tns2jWNxtmi3tahmkSw,45226
@@ -28,8 +28,8 @@ tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
28
28
  tests/test_allocation_config.py,sha256=e12l6fE9U57eSPS35g6ekJ_hol7-RHg89JV60_m1BlE,4633
29
29
  tests/test_handy_mix_config.py,sha256=Un56mz9KJmdn4K4OwzHAHLSRzDU1Xv2nFrONNuzOG04,2594
30
30
  tests/test_xml_parser.py,sha256=3QTlhFEd6KbK6nRFKZnc35tad6wqukTbe4QrFi8mr_8,859
31
- berryworld-1.0.0.158880.dist-info/LICENSE,sha256=vtkVCJM6E2af2gnsi2XxKPr4WY-uIbvzVLXieFND0UU,1074
32
- berryworld-1.0.0.158880.dist-info/METADATA,sha256=8N6fHgaupBR5v4I6VA5Thf1eg_mm2KEZEzhvZDwl1fM,1107
33
- berryworld-1.0.0.158880.dist-info/WHEEL,sha256=Xo9-1PvkuimrydujYJAjF7pCkriuXBpUPEjma1nZyJ0,92
34
- berryworld-1.0.0.158880.dist-info/top_level.txt,sha256=GIZ5qy-P5oxfEH755vA1IMFeTVdX3-40JxMe6nOe5I8,17
35
- berryworld-1.0.0.158880.dist-info/RECORD,,
31
+ berryworld-1.0.0.161179.dist-info/LICENSE,sha256=vtkVCJM6E2af2gnsi2XxKPr4WY-uIbvzVLXieFND0UU,1074
32
+ berryworld-1.0.0.161179.dist-info/METADATA,sha256=RGElum3-BiSA1rEu07LFd_XhqxUdnV3N_aMeo1XVOxs,1107
33
+ berryworld-1.0.0.161179.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
34
+ berryworld-1.0.0.161179.dist-info/top_level.txt,sha256=GIZ5qy-P5oxfEH755vA1IMFeTVdX3-40JxMe6nOe5I8,17
35
+ berryworld-1.0.0.161179.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.41.3)
2
+ Generator: bdist_wheel (0.42.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5