commons-metrics 0.0.3__tar.gz → 0.0.4__tar.gz

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,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
@@ -13,6 +13,8 @@ A simple Python library for basic statistical calculations.
13
13
  pip install twine
14
14
  twine upload dist/*
15
15
  input token
16
+ git ignore buill,commons_metrics.egg-info, dist
17
+
16
18
 
17
19
  ## Installation
18
20
 
@@ -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()
@@ -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
@@ -2,6 +2,7 @@ LICENSE
2
2
  README.md
3
3
  setup.py
4
4
  commons_metrics/__init__.py
5
+ commons_metrics/data_base.py
5
6
  commons_metrics/util.py
6
7
  commons_metrics.egg-info/PKG-INFO
7
8
  commons_metrics.egg-info/SOURCES.txt
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name='commons_metrics',
5
- version='0.0.3',
5
+ version='0.0.4',
6
6
  description='A simple library for basic statistical calculations',
7
7
  #long_description=open('USAGE.md').read(),
8
8
  #long_description_content_type='text/markdown',
File without changes