ucampostgresvro 0.1.1__py3-none-any.whl → 0.2.0__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,7 +1,7 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: ucampostgresvro
3
- Version: 0.1.1
4
- Summary:
3
+ Version: 0.2.0
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",
@@ -55,6 +55,8 @@ pre_setupconfig(db_params)
55
55
  - To perform CRUD operation
56
56
  ```
57
57
  from ucampostgresvro.DBA import DB
58
+ from datetime import datetime
59
+
58
60
  db_params = {
59
61
  "dbname": "vrapricing",
60
62
  "user": "postgres",
@@ -74,6 +76,15 @@ db.insert_vrauser("ll220", "Ling-Yan Lau")
74
76
  # read user
75
77
  print(db.get_vrauser())
76
78
 
79
+ # read user specific user by crsid
80
+ print(db.get_vrauser("ll220"))
81
+
82
+ # read user specific user by user id
83
+ print(db.get_vrauser_by_id(1))
84
+
85
+ # get the primary key of user using crsid
86
+ print(db.get_vrauser_primary_key("ll220"))
87
+
77
88
  # update user
78
89
  db.update_vrauser("ll220", "bda20", 'Ben Argyle')
79
90
 
@@ -83,9 +94,18 @@ db.remove_vrauser('bda20')
83
94
  # create vra deploymentid
84
95
  db.insert_deployment_id("1231ee112ad11212")
85
96
 
86
- # read vra deployment id
97
+ # read all the vra deployment ids
98
+ print(db.get_deployment_id())
99
+
100
+ # read specific specific deploymentid by deploymentid
87
101
  print(db.get_deployment_id("1231a"))
88
102
 
103
+ # read specific deploymentid by primary key
104
+ print(db.get_deployment_id_by_id(1))
105
+
106
+ # read primary key of specific deploymentid
107
+ print(db.get_deployment_id_primary_key("1231a"))
108
+
89
109
  # update vra deployment id
90
110
  db.update_deployment_id("1231ee112ad1", "1231a")
91
111
 
@@ -95,38 +115,77 @@ db.remove_deployment_id('1231a')
95
115
  # create project
96
116
  db.insert_project("0001",1,100.0)
97
117
 
98
- # read project
118
+ # read all the projects
99
119
  print(db.get_project())
100
120
 
101
- # update project
102
- db.update_project("0001", "0002", 4, 200)
121
+ # read specific project
122
+ print(db.get_project("0001"))
123
+
124
+ # read project from the ID
125
+ print(db.get_project_by_id(1))
126
+
127
+ # get the primary key of the project
128
+ print(db.get_project_primary_key("001"))
129
+
130
+ # get the primary key of the project if more than 1 entites using date of insertion.
131
+ print(db.get_project_primary_key("001", datetime(2025, 1, 22, 15, 55, 25, 95698)))
132
+
133
+ # update project with new information 1 is the primary key
134
+ db.update_project(1, "0002", 4, 200)
103
135
 
104
- # delete project
105
- # db.remove_project("0002")
136
+ # delete project using primary key of project
137
+ # db.remove_project(1)
106
138
 
107
139
  # create grant
108
140
  db.insert_grant("0001",1,100.0)
109
141
 
110
- # read grant
142
+ # read all the grants
111
143
  print(db.get_grant())
112
144
 
113
- # update grant
114
- db.update_grant("0001", "0002", 4, 200)
145
+ # read specific grant
146
+ print(db.get_grant("0001"))
115
147
 
116
- # delete grant
117
- db.remove_grant("0002")
148
+ # read grant from the ID
149
+ print(db.get_grant_by_id(1))
150
+
151
+ # get the primary key of the grant
152
+ print(db.get_grant_primary_key("001"))
153
+
154
+ # get the primary key of the grant if more than 1 entites using date of insertion.
155
+ print(db.get_grant_primary_key("001", datetime(2025, 1, 22, 15, 55, 25, 95698)))
156
+
157
+ # update grant with new information 1 is the primary key of grant
158
+ db.update_grant(1, "2002", 4, 200)
159
+
160
+ # delete grant 1 is the primary key of the grant
161
+ db.remove_grant(1)
118
162
 
119
163
  # create costing
120
164
  db.insert_costing(2, "Initial Resource", project_id=4, grant_id=None)
121
165
 
122
- # read costing
166
+ # read all the costing
123
167
  print(db.get_costing())
124
168
 
125
- # update costing
126
- db.update_costing(2, "Duration Expansion", old_grant_id=4, old_project_id=None, grant_id=4, project_id=None)
169
+ # read specific costing using primary key of the costing
170
+ print(db.get_costing_by_id(1))
171
+
172
+ # read specific costing for the project
173
+ print(db.get_costing(2, "Initial Resource", 2))
127
174
 
128
- # delete costing
129
- db.remove_costing(2, "Duration Expansion", 4, None)
175
+ # read specific costing for the grant
176
+ print(db.get_costing(2, "Initial Resource", None, 2))
177
+
178
+ # get primary key for the specific costing for the project
179
+ print(db.get_costing_primary_key(2, "Initial Resource", 2))
180
+
181
+ # get primary key for the specific costing for the grant
182
+ print(db.get_costing_primary_key(2, "Initial Resource", None, 2))
183
+
184
+ # update costing where 3 is the primary key of the costing.
185
+ db.update_costing(3, 2, "Duration Expansion", new_grant_id=None, new_project_id=2)
186
+
187
+ # delete costing where 3 is the primary key
188
+ db.remove_costing(3)
130
189
 
131
190
  # to close db connection
132
191
  db.closedb()
@@ -173,39 +232,40 @@ Referenced by:
173
232
 
174
233
  ## - project table
175
234
  ```
176
- vrapricing=# \d projects;
177
- Table "public.projects"
178
- Column | Type | Collation | Nullable | Default
179
- ----------------+------------------------+-----------+----------+--------------------------------------
180
- id | integer | | not null | nextval('projects_id_seq'::regclass)
181
- project_number | character varying(255) | | |
182
- paid_by | integer | | |
183
- amount | double precision | | not null |
235
+ vrapricing=# \d projects
236
+ Table "public.projects"
237
+ Column | Type | Collation | Nullable | Default
238
+ ----------------+-----------------------------+-----------+----------+--------------------------------------
239
+ id | integer | | not null | nextval('projects_id_seq'::regclass)
240
+ date | timestamp without time zone | | | CURRENT_TIMESTAMP
241
+ project_number | character varying(255) | | |
242
+ paid_by | integer | | |
243
+ amount | double precision | | not null |
184
244
  Indexes:
185
245
  "projects_pkey" PRIMARY KEY, btree (id)
186
246
  Foreign-key constraints:
187
247
  "projects_paid_by_fkey" FOREIGN KEY (paid_by) REFERENCES vrauser(id)
188
248
  Referenced by:
189
249
  TABLE "costing" CONSTRAINT "costing_project_id_fkey" FOREIGN KEY (project_id) REFERENCES projects(id)
190
-
191
250
  ```
192
251
 
193
252
  ## - grants table
194
253
  ```
195
- vrapricing=# \d grant;
196
- Table "public.grant"
197
- Column | Type | Collation | Nullable | Default
198
- ----------------+------------------------+-----------+----------+--------------------------------------
199
- id | integer | | not null | nextval('grant_id_seq'::regclass)
200
- voucher_number | character varying(255) | | |
201
- paid_by | integer | | |
202
- amount | double precision | | not null |
254
+ vrapricing=# \d grants
255
+ Table "public.grants"
256
+ Column | Type | Collation | Nullable | Default
257
+ --------------+-----------------------------+-----------+----------+------------------------------------
258
+ id | integer | | not null | nextval('grants_id_seq'::regclass)
259
+ date | timestamp without time zone | | | CURRENT_TIMESTAMP
260
+ grant_number | character varying(255) | | |
261
+ paid_by | integer | | |
262
+ amount | double precision | | not null |
203
263
  Indexes:
204
- "grant_pkey" PRIMARY KEY, btree (id)
264
+ "grants_pkey" PRIMARY KEY, btree (id)
205
265
  Foreign-key constraints:
206
- "grant_paid_by_fkey" FOREIGN KEY (paid_by) REFERENCES vrauser(id)
266
+ "grants_paid_by_fkey" FOREIGN KEY (paid_by) REFERENCES vrauser(id)
207
267
  Referenced by:
208
- TABLE "costing" CONSTRAINT "costing_voucher_id_fkey" FOREIGN KEY (voucher_id) REFERENCES grant(id)
268
+ TABLE "costing" CONSTRAINT "costing_grant_id_fkey" FOREIGN KEY (grant_id) REFERENCES grants(id)
209
269
  ```
210
270
 
211
271
  ## - Costing table
@@ -0,0 +1,16 @@
1
+ ucampostgresvro/DBA.py,sha256=t8un2LmoTnHczbYMWl4hO7MVDfGZJTFe7xUXKyD3Cbg,37961
2
+ ucampostgresvro/__init__.py,sha256=w9Iw7QVvd8lme2wKwEbCo5IgetVjSfFBOOYAcA_Q0Ns,18
3
+ ucampostgresvro/__main__.py,sha256=RGTDhAAIoY-w6h64aKnsfv665DmdFf7cVwbX_Z16vWU,4122
4
+ ucampostgresvro/ca.crt,sha256=pVDr3AsvwCqJ36JTifsAzIiS2ve_fWC1CBfVI0cnVmY,1135
5
+ ucampostgresvro/exceptions.py,sha256=XVi8Sk_gg3VE4ryTtiYOnGbmCPIsfFt2AE5sOoqQDuI,39
6
+ ucampostgresvro/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
+ ucampostgresvro/tests/conftest.py,sha256=t89U_SOcWf2q0C_m4Vn89LSLwxnQC-_rUAvt6yNeOWA,1803
8
+ ucampostgresvro/tests/dbconnect.py,sha256=pKU95buCUAUw0plBcaFqhCn7zPjW_PQreONasHlEh_Q,241
9
+ ucampostgresvro/tests/test_DB.py,sha256=lye6NLUS2k7W7Kr083fQ5HDUD5hMMUqvIXL2xbNoRUk,16338
10
+ ucampostgresvro/tests/utils.py,sha256=lpcvf6HPOOtxAwSwvoAUhil1zQ6Qfr0ZILa0qDVdES0,3722
11
+ ucampostgresvro/tools.py,sha256=Y8MUK1lIG10A-724yrhve8LfjQUmFwpqi19UIO5DeuI,153
12
+ ucampostgresvro/utils.py,sha256=QYhWaBaxGn-yKEGm___3-7RitbIWwICTplbz7LyKgLE,8543
13
+ ucampostgresvro-0.2.0.dist-info/LICENSE,sha256=CVTj8C-BHEJjzYlYtHnfykxKkfmk-ImXOs5rcMgXebY,1094
14
+ ucampostgresvro-0.2.0.dist-info/METADATA,sha256=IQ303ShVE8nT0g5qF_G1o473KIopfYzSHvdVJNdeIjI,9791
15
+ ucampostgresvro-0.2.0.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
16
+ ucampostgresvro-0.2.0.dist-info/RECORD,,
@@ -1,16 +0,0 @@
1
- ucampostgresvro/DBA.py,sha256=LGj2JpP2B-6z7CFV-zloLNmW8dPcIyuItVRi5x0KQT0,30876
2
- ucampostgresvro/__init__.py,sha256=K4bqp4JdOs9KHYMltFboNleHcCgvR1V7uAJwB8wlYQw,18
3
- ucampostgresvro/__main__.py,sha256=bTpOR1L6o5nZhM391sdZA6G3861jdwHQRdgAuXvL_dQ,4395
4
- ucampostgresvro/ca.crt,sha256=pVDr3AsvwCqJ36JTifsAzIiS2ve_fWC1CBfVI0cnVmY,1135
5
- ucampostgresvro/exceptions.py,sha256=XVi8Sk_gg3VE4ryTtiYOnGbmCPIsfFt2AE5sOoqQDuI,39
6
- ucampostgresvro/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
- ucampostgresvro/tests/conftest.py,sha256=t89U_SOcWf2q0C_m4Vn89LSLwxnQC-_rUAvt6yNeOWA,1803
8
- ucampostgresvro/tests/dbconnect.py,sha256=T2rVoUmG6mHwS-i4h8R4O4GuEhuucCd3zyrFUMMhkE4,240
9
- ucampostgresvro/tests/test_DB.py,sha256=SLi5C0NO0dIeIQOfywkAPWKznfANopVEnHOxCD-EZpU,12134
10
- ucampostgresvro/tests/utils.py,sha256=lpcvf6HPOOtxAwSwvoAUhil1zQ6Qfr0ZILa0qDVdES0,3722
11
- ucampostgresvro/tools.py,sha256=Y8MUK1lIG10A-724yrhve8LfjQUmFwpqi19UIO5DeuI,153
12
- ucampostgresvro/utils.py,sha256=d49ecdYfFXHK0H4Huc7x2C9sEc_R_3MG3lyNgBvWSyg,6907
13
- ucampostgresvro-0.1.1.dist-info/LICENSE,sha256=CVTj8C-BHEJjzYlYtHnfykxKkfmk-ImXOs5rcMgXebY,1094
14
- ucampostgresvro-0.1.1.dist-info/METADATA,sha256=7rwwVHjjXwx5GQp1ymgdOgwb9KSEtf5o9cMtdLOcw9g,7594
15
- ucampostgresvro-0.1.1.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
16
- ucampostgresvro-0.1.1.dist-info/RECORD,,