commons-metrics 0.0.3__py3-none-any.whl → 0.0.4__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.
@@ -1,4 +1,4 @@
1
1
  from .util import Util
2
2
 
3
3
  __all__ = ['Util']
4
- __version__ = '0.1.0'
4
+ __version__ = '0.0.4'
@@ -0,0 +1,45 @@
1
+ import psycopg2
2
+
3
+ class DataBase:
4
+ def __init__(self, db_name):
5
+ self.connection = None
6
+
7
+ def connect(self, host, port, dbname, user, password):
8
+ try:
9
+ self.connection = psycopg2.connect(
10
+ host=host,
11
+ port=port,
12
+ database=dbname,
13
+ user=user,
14
+ password=password,
15
+ connect_timeout=30
16
+ )
17
+
18
+ except Exception as e:
19
+ if self.connection:
20
+ self.connection.rollback()
21
+ msg = f"Database connection error: {str(e)}"
22
+ raise Exception(msg)
23
+
24
+ def disconnect(self):
25
+ if self.connectWWWion:
26
+ self.connection.close()
27
+
28
+ def save_component(technical_name, id_type):
29
+ try:
30
+ cursor = connection.cursor()
31
+ params_insert = (
32
+ technical_name,
33
+ id_type
34
+ )
35
+
36
+ #cursor.execute("select id_component into v_id_component from schmesys.component where technical_name = v_component_name;", params)
37
+ cursor.execute("INSERT INTO schmesys.component(technical_name,id_type) values (%s, %d);", params_insert)
38
+ except Exception as e:
39
+ if self.connection:
40
+ self.connection.rollback()
41
+ msg = f"Database connection error: {str(e)}"
42
+ raise Exception(msg)
43
+ finally:
44
+ if cursor:
45
+ cursor.close()
commons_metrics/util.py CHANGED
@@ -34,4 +34,6 @@ class Util:
34
34
 
35
35
  @staticmethod
36
36
  def show(env: str, logger):
37
- print("Hola mundo")
37
+ print("Hola mundo")
38
+ print(f"Environment: {env}")
39
+
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: commons_metrics
3
- Version: 0.0.3
3
+ Version: 0.0.4
4
4
  Summary: A simple library for basic statistical calculations
5
5
  Author: Bancolombia
6
6
  Author-email: omar.david.pino@email.com
@@ -0,0 +1,8 @@
1
+ commons_metrics/__init__.py,sha256=RRtS7dpbGr6V0p2t_wGcqMOnyW1IxADMwo25i3BjKyU,64
2
+ commons_metrics/data_base.py,sha256=7I9ywLqQMtTlK1uuubM8WrffwDsL9uyP3sygqanUQvQ,1439
3
+ commons_metrics/util.py,sha256=H8lyVqfy73AvohCedBRoadpFnqRhGRiEnjI7b6tvg2w,1288
4
+ commons_metrics-0.0.4.dist-info/licenses/LICENSE,sha256=jsHZ2Sh1wCL74HC25pDDGXCyQ0xgsTAy62FvEnehKIg,1067
5
+ commons_metrics-0.0.4.dist-info/METADATA,sha256=bWcn6USQP6aqgq3Gferi-sv74yf5qlM805m2nVk2fpM,401
6
+ commons_metrics-0.0.4.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
7
+ commons_metrics-0.0.4.dist-info/top_level.txt,sha256=lheUN-3OKdU3A8Tg8Y-1IEB_9i_vVRA0g_FOiUsTQz8,16
8
+ commons_metrics-0.0.4.dist-info/RECORD,,
@@ -1,7 +0,0 @@
1
- commons_metrics/__init__.py,sha256=EqBumKI85i-qgaT_d7Vw_IWiKg7ARdY642aw3gLnMBI,64
2
- commons_metrics/util.py,sha256=qxpXQOPBSh2jD8try1nD8fRRdyZwMAZWQQKFT6XajSU,1249
3
- commons_metrics-0.0.3.dist-info/licenses/LICENSE,sha256=jsHZ2Sh1wCL74HC25pDDGXCyQ0xgsTAy62FvEnehKIg,1067
4
- commons_metrics-0.0.3.dist-info/METADATA,sha256=L7lny4AYLCNf_gIa4_F9DUy-WqlfXzfMvFiqZCoHxgs,401
5
- commons_metrics-0.0.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
6
- commons_metrics-0.0.3.dist-info/top_level.txt,sha256=lheUN-3OKdU3A8Tg8Y-1IEB_9i_vVRA0g_FOiUsTQz8,16
7
- commons_metrics-0.0.3.dist-info/RECORD,,