commons-metrics 0.0.5__tar.gz → 0.0.6__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.
- {commons_metrics-0.0.5 → commons_metrics-0.0.6}/PKG-INFO +1 -1
- commons_metrics-0.0.6/commons_metrics/__init__.py +6 -0
- commons_metrics-0.0.6/commons_metrics/repositories.py +43 -0
- {commons_metrics-0.0.5 → commons_metrics-0.0.6}/commons_metrics.egg-info/PKG-INFO +1 -1
- {commons_metrics-0.0.5 → commons_metrics-0.0.6}/commons_metrics.egg-info/SOURCES.txt +1 -0
- {commons_metrics-0.0.5 → commons_metrics-0.0.6}/setup.py +1 -1
- commons_metrics-0.0.5/commons_metrics/__init__.py +0 -5
- {commons_metrics-0.0.5 → commons_metrics-0.0.6}/LICENSE +0 -0
- {commons_metrics-0.0.5 → commons_metrics-0.0.6}/README.md +0 -0
- {commons_metrics-0.0.5 → commons_metrics-0.0.6}/commons_metrics/database.py +0 -0
- {commons_metrics-0.0.5 → commons_metrics-0.0.6}/commons_metrics/util.py +0 -0
- {commons_metrics-0.0.5 → commons_metrics-0.0.6}/commons_metrics.egg-info/dependency_links.txt +0 -0
- {commons_metrics-0.0.5 → commons_metrics-0.0.6}/commons_metrics.egg-info/requires.txt +0 -0
- {commons_metrics-0.0.5 → commons_metrics-0.0.6}/commons_metrics.egg-info/top_level.txt +0 -0
- {commons_metrics-0.0.5 → commons_metrics-0.0.6}/setup.cfg +0 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
class ComponentRepository:
|
|
2
|
+
"""
|
|
3
|
+
Repository class for component-specific database operations
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
def __init__(self, db_connection):
|
|
7
|
+
"""
|
|
8
|
+
Initialize repository with database connection
|
|
9
|
+
"""
|
|
10
|
+
self.db = db_connection
|
|
11
|
+
|
|
12
|
+
def save_component(self, technical_name, id_type, status=1):
|
|
13
|
+
"""
|
|
14
|
+
Inserts a new component into schmesys.component table
|
|
15
|
+
|
|
16
|
+
Args:
|
|
17
|
+
technical_name (str): Technical name of the component
|
|
18
|
+
id_type (int): Component type ID
|
|
19
|
+
status (int): Component status (default: 1)
|
|
20
|
+
"""
|
|
21
|
+
cursor = None
|
|
22
|
+
try:
|
|
23
|
+
cursor = self.db.connection.cursor()
|
|
24
|
+
|
|
25
|
+
insert_query = """
|
|
26
|
+
INSERT INTO schmesys.component(technical_name, id_type, status)
|
|
27
|
+
VALUES (%s, %s, %s)
|
|
28
|
+
RETURNING id;
|
|
29
|
+
"""
|
|
30
|
+
|
|
31
|
+
cursor.execute(insert_query, (technical_name, id_type, status))
|
|
32
|
+
component_id = cursor.fetchone()[0]
|
|
33
|
+
self.db.commit_transaction()
|
|
34
|
+
|
|
35
|
+
return component_id
|
|
36
|
+
|
|
37
|
+
except Exception as e:
|
|
38
|
+
self.db.rollback_transaction()
|
|
39
|
+
raise Exception(f"Error saving component '{technical_name}': {str(e)}")
|
|
40
|
+
finally:
|
|
41
|
+
if cursor:
|
|
42
|
+
cursor.close()
|
|
43
|
+
|
|
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
|
|
|
2
2
|
|
|
3
3
|
setup(
|
|
4
4
|
name='commons_metrics',
|
|
5
|
-
version='0.0.
|
|
5
|
+
version='0.0.6',
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{commons_metrics-0.0.5 → commons_metrics-0.0.6}/commons_metrics.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|