ucampostgresvro 0.1.1__py3-none-any.whl → 0.1.2__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.
- ucampostgresvro/__init__.py +1 -1
- ucampostgresvro/__main__.py +1 -49
- ucampostgresvro/utils.py +42 -0
- {ucampostgresvro-0.1.1.dist-info → ucampostgresvro-0.1.2.dist-info}/METADATA +3 -3
- {ucampostgresvro-0.1.1.dist-info → ucampostgresvro-0.1.2.dist-info}/RECORD +7 -7
- {ucampostgresvro-0.1.1.dist-info → ucampostgresvro-0.1.2.dist-info}/LICENSE +0 -0
- {ucampostgresvro-0.1.1.dist-info → ucampostgresvro-0.1.2.dist-info}/WHEEL +0 -0
ucampostgresvro/__init__.py
CHANGED
@@ -1 +1 @@
|
|
1
|
-
VERSION = "0.1.
|
1
|
+
VERSION = "0.1.2"
|
ucampostgresvro/__main__.py
CHANGED
@@ -1,12 +1,10 @@
|
|
1
1
|
import logging
|
2
2
|
import sys
|
3
|
-
from typing import Dict
|
4
3
|
|
5
4
|
from ucampostgresvro import VERSION, utils
|
6
5
|
from ucampostgresvro.DBA import DB
|
7
6
|
from ucampostgresvro.exceptions import DbException
|
8
7
|
from ucampostgresvro.secrets import password
|
9
|
-
from ucampostgresvro.tools import DEFAULT_TABLES
|
10
8
|
|
11
9
|
|
12
10
|
def setloggerdetail():
|
@@ -21,52 +19,6 @@ def setloggerdetail():
|
|
21
19
|
return LOG
|
22
20
|
|
23
21
|
|
24
|
-
def pre_setupconfig(db_params: Dict[str, str]) -> bool:
|
25
|
-
"""Create the Database
|
26
|
-
|
27
|
-
Args:
|
28
|
-
db_params (Dict[str, str]): provide parameters for DB connection.
|
29
|
-
|
30
|
-
Returns:
|
31
|
-
bool: True if creation of database is suceess else False
|
32
|
-
"""
|
33
|
-
result = []
|
34
|
-
if not utils.check_table_exists(DEFAULT_TABLES.get("user"), db_params):
|
35
|
-
result.append(utils.create_user_table(DEFAULT_TABLES.get("user"), db_params))
|
36
|
-
|
37
|
-
if not utils.check_table_exists(DEFAULT_TABLES.get("deploymentid"), db_params):
|
38
|
-
result.append(
|
39
|
-
utils.create_deployment_table(DEFAULT_TABLES.get("deploymentid"), db_params)
|
40
|
-
)
|
41
|
-
|
42
|
-
if not utils.check_table_exists(DEFAULT_TABLES.get("proj"), db_params):
|
43
|
-
result.append(
|
44
|
-
utils.create_project_table(
|
45
|
-
DEFAULT_TABLES.get("proj"), DEFAULT_TABLES.get("user"), db_params
|
46
|
-
)
|
47
|
-
)
|
48
|
-
|
49
|
-
if not utils.check_table_exists(DEFAULT_TABLES.get("grant"), db_params):
|
50
|
-
result.append(
|
51
|
-
utils.create_grant_table(
|
52
|
-
DEFAULT_TABLES.get("grant"), DEFAULT_TABLES.get("user"), db_params
|
53
|
-
)
|
54
|
-
)
|
55
|
-
|
56
|
-
if not utils.check_table_exists(DEFAULT_TABLES.get("costing"), db_params):
|
57
|
-
result.append(
|
58
|
-
utils.create_costing_table(
|
59
|
-
DEFAULT_TABLES.get("costing"),
|
60
|
-
DEFAULT_TABLES.get("deploymentid"),
|
61
|
-
DEFAULT_TABLES.get("proj"),
|
62
|
-
DEFAULT_TABLES.get("grant"),
|
63
|
-
db_params,
|
64
|
-
)
|
65
|
-
)
|
66
|
-
|
67
|
-
return False not in result
|
68
|
-
|
69
|
-
|
70
22
|
def main():
|
71
23
|
LOG = setloggerdetail()
|
72
24
|
LOG.info(f"VERSION : {VERSION}")
|
@@ -81,7 +33,7 @@ def main():
|
|
81
33
|
}
|
82
34
|
db = DB(db_params)
|
83
35
|
|
84
|
-
if not pre_setupconfig(db_params):
|
36
|
+
if not utils.pre_setupconfig(db_params):
|
85
37
|
raise DbException("ERROR: Tables are not created successfully")
|
86
38
|
|
87
39
|
# db.insert_vrauser("ll220", "len")
|
ucampostgresvro/utils.py
CHANGED
@@ -3,10 +3,52 @@ from typing import Callable, Dict
|
|
3
3
|
|
4
4
|
from ucampostgresvro.DBA import DB
|
5
5
|
from ucampostgresvro.exceptions import DbException
|
6
|
+
from ucampostgresvro.tools import DEFAULT_TABLES
|
6
7
|
|
7
8
|
LOG = logging.getLogger(__name__)
|
8
9
|
|
9
10
|
|
11
|
+
def pre_setupconfig(db_params: Dict[str, str]) -> bool:
|
12
|
+
"""Create the Database
|
13
|
+
|
14
|
+
Args:
|
15
|
+
db_params (Dict[str, str]): provide parameters for DB connection.
|
16
|
+
|
17
|
+
Returns:
|
18
|
+
bool: True if creation of database is suceess else False
|
19
|
+
"""
|
20
|
+
result = []
|
21
|
+
if not check_table_exists(DEFAULT_TABLES.get("user"), db_params):
|
22
|
+
result.append(create_user_table(DEFAULT_TABLES.get("user"), db_params))
|
23
|
+
if not check_table_exists(DEFAULT_TABLES.get("deploymentid"), db_params):
|
24
|
+
result.append(
|
25
|
+
create_deployment_table(DEFAULT_TABLES.get("deploymentid"), db_params)
|
26
|
+
)
|
27
|
+
if not check_table_exists(DEFAULT_TABLES.get("proj"), db_params):
|
28
|
+
result.append(
|
29
|
+
create_project_table(
|
30
|
+
DEFAULT_TABLES.get("proj"), DEFAULT_TABLES.get("user"), db_params
|
31
|
+
)
|
32
|
+
)
|
33
|
+
if not check_table_exists(DEFAULT_TABLES.get("grant"), db_params):
|
34
|
+
result.append(
|
35
|
+
create_grant_table(
|
36
|
+
DEFAULT_TABLES.get("grant"), DEFAULT_TABLES.get("user"), db_params
|
37
|
+
)
|
38
|
+
)
|
39
|
+
if not check_table_exists(DEFAULT_TABLES.get("costing"), db_params):
|
40
|
+
result.append(
|
41
|
+
create_costing_table(
|
42
|
+
DEFAULT_TABLES.get("costing"),
|
43
|
+
DEFAULT_TABLES.get("deploymentid"),
|
44
|
+
DEFAULT_TABLES.get("proj"),
|
45
|
+
DEFAULT_TABLES.get("grant"),
|
46
|
+
db_params,
|
47
|
+
)
|
48
|
+
)
|
49
|
+
return False not in result
|
50
|
+
|
51
|
+
|
10
52
|
def create_table(tablename: str, db_params: Dict[str, str], design: str) -> bool:
|
11
53
|
"""Creation of table with provided design
|
12
54
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
Metadata-Version: 2.3
|
2
2
|
Name: ucampostgresvro
|
3
|
-
Version: 0.1.
|
4
|
-
Summary:
|
3
|
+
Version: 0.1.2
|
4
|
+
Summary: To connect with postgresql for the billing report
|
5
5
|
Author: Ishan Mahajan
|
6
6
|
Author-email: mahanishanmahajan@gmail.com
|
7
7
|
Requires-Python: >=3.10
|
@@ -38,7 +38,7 @@ Description-Content-Type: text/markdown
|
|
38
38
|
|
39
39
|
- To setup database
|
40
40
|
```
|
41
|
-
from ucampostgresvro import pre_setupconfig
|
41
|
+
from ucampostgresvro.utils import pre_setupconfig
|
42
42
|
from ucampostgresvro.DBA import DB
|
43
43
|
db_params = {
|
44
44
|
"dbname": "vrapricing",
|
@@ -1,6 +1,6 @@
|
|
1
1
|
ucampostgresvro/DBA.py,sha256=LGj2JpP2B-6z7CFV-zloLNmW8dPcIyuItVRi5x0KQT0,30876
|
2
|
-
ucampostgresvro/__init__.py,sha256=
|
3
|
-
ucampostgresvro/__main__.py,sha256=
|
2
|
+
ucampostgresvro/__init__.py,sha256=3ITyQfKn-h4AMdaHk5rHJaliZbCnbLZ7O3QQnAJH8yI,18
|
3
|
+
ucampostgresvro/__main__.py,sha256=oEX2F0_bl2Xrq6_l9YZb1ZBIhxRwzuSPpauqjCm0YjE,2780
|
4
4
|
ucampostgresvro/ca.crt,sha256=pVDr3AsvwCqJ36JTifsAzIiS2ve_fWC1CBfVI0cnVmY,1135
|
5
5
|
ucampostgresvro/exceptions.py,sha256=XVi8Sk_gg3VE4ryTtiYOnGbmCPIsfFt2AE5sOoqQDuI,39
|
6
6
|
ucampostgresvro/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -9,8 +9,8 @@ ucampostgresvro/tests/dbconnect.py,sha256=T2rVoUmG6mHwS-i4h8R4O4GuEhuucCd3zyrFUM
|
|
9
9
|
ucampostgresvro/tests/test_DB.py,sha256=SLi5C0NO0dIeIQOfywkAPWKznfANopVEnHOxCD-EZpU,12134
|
10
10
|
ucampostgresvro/tests/utils.py,sha256=lpcvf6HPOOtxAwSwvoAUhil1zQ6Qfr0ZILa0qDVdES0,3722
|
11
11
|
ucampostgresvro/tools.py,sha256=Y8MUK1lIG10A-724yrhve8LfjQUmFwpqi19UIO5DeuI,153
|
12
|
-
ucampostgresvro/utils.py,sha256=
|
13
|
-
ucampostgresvro-0.1.
|
14
|
-
ucampostgresvro-0.1.
|
15
|
-
ucampostgresvro-0.1.
|
16
|
-
ucampostgresvro-0.1.
|
12
|
+
ucampostgresvro/utils.py,sha256=ZHS9D3Eplyk3Ck-AoVG_2YgVJJNmuO6J-FaZGsJKGs4,8439
|
13
|
+
ucampostgresvro-0.1.2.dist-info/LICENSE,sha256=CVTj8C-BHEJjzYlYtHnfykxKkfmk-ImXOs5rcMgXebY,1094
|
14
|
+
ucampostgresvro-0.1.2.dist-info/METADATA,sha256=ICcEjopmJAXYGhqzbGO-H3JSFO2dBV33vuV8qslIEAw,7649
|
15
|
+
ucampostgresvro-0.1.2.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
|
16
|
+
ucampostgresvro-0.1.2.dist-info/RECORD,,
|
File without changes
|
File without changes
|