velocity-python 0.0.115__py3-none-any.whl → 0.0.116__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.

Potentially problematic release.


This version of velocity-python might be problematic. Click here for more details.

velocity/__init__.py CHANGED
@@ -1,4 +1,4 @@
1
- __version__ = version = "0.0.115"
1
+ __version__ = version = "0.0.116"
2
2
 
3
3
  from . import aws
4
4
  from . import db
@@ -75,8 +75,11 @@ class Context:
75
75
  else:
76
76
  print(f"{message}")
77
77
 
78
- def updateJob(self, tx, data=None):
79
- """Update job status and message in aws_job_activity table."""
78
+ def update_job(self, tx, data=None):
79
+ """Update job status and message in aws_job_activity table.
80
+
81
+ This method only UPDATES existing jobs. For creating new jobs, use create_job.
82
+ """
80
83
  if not data:
81
84
  return
82
85
  if self.postdata("job_id"):
@@ -84,6 +87,12 @@ class Context:
84
87
  sanitized_data = self._sanitize_job_data(data)
85
88
  tx.table("aws_job_activity").update(sanitized_data, {"job_id": self.postdata("job_id")})
86
89
  tx.commit()
90
+
91
+ def create_job(self, job_data):
92
+ """Create a new job record in aws_job_activity table using independent transaction."""
93
+ sanitized_data = self._sanitize_job_data(job_data)
94
+ tx.table("aws_job_activity").insert(sanitized_data)
95
+ tx.commit()
87
96
 
88
97
  def _sanitize_job_data(self, data):
89
98
  """Sanitize sensitive data before storing in aws_job_activity table."""
@@ -182,21 +191,17 @@ class Context:
182
191
  else:
183
192
  message["job_id"] = id
184
193
  # Use separate transaction for job activity - this should never be rolled back
185
- with engine.transaction as job_tx:
186
- job_tx.table("aws_job_activity").insert(
187
- {
188
- "action": action,
189
- "initial_timestamp": datetime.now(),
190
- "created_by": user,
191
- "sys_modified_by": user,
192
- "payload": to_json(message),
193
- "batch_id": str(batch_id),
194
- "job_id": id,
195
- "status": "Initialized",
196
- "message": f"Job Initialized"
197
- }
198
- )
199
- job_tx.commit()
194
+ self.create_job({
195
+ "action": action,
196
+ "initial_timestamp": datetime.now(),
197
+ "created_by": user,
198
+ "sys_modified_by": user,
199
+ "payload": to_json(message),
200
+ "batch_id": str(batch_id),
201
+ "job_id": id,
202
+ "status": "Initialized",
203
+ "message": f"Job Initialized"
204
+ })
200
205
  messages.append({"Id": id, "MessageBody": to_json(message)})
201
206
 
202
207
  if len(messages) == 10:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: velocity-python
3
- Version: 0.0.115
3
+ Version: 0.0.116
4
4
  Summary: A rapid application development library for interfacing with data storage
5
5
  Author-email: Velocity Team <info@codeclubs.org>
6
6
  License-Expression: MIT
@@ -1,4 +1,4 @@
1
- velocity/__init__.py,sha256=89oRDLFlR3tlSTcYrvhfokSBF3tLPmP4nt_p9ayIScY,107
1
+ velocity/__init__.py,sha256=9HZOcPjfok_APV3xMWucAvFzJMi0ieQU4-E1pepEZZs,107
2
2
  velocity/app/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
3
  velocity/app/invoices.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
4
  velocity/app/orders.py,sha256=W-HAXEwY8-IFXbKh82HnMeRVZM7P-TWGEQOWtkLIzI4,6298
@@ -7,7 +7,7 @@ velocity/app/purchase_orders.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSu
7
7
  velocity/aws/__init__.py,sha256=tj9-NliYxRVPYLnnDuA4FMwBHbbH4ed8gtHgwRskNgY,647
8
8
  velocity/aws/amplify.py,sha256=n6ttzHmbF8tc0ZDN8LIA6s_fnkZ3ylu3AAUAYyD9MzE,15048
9
9
  velocity/aws/handlers/__init__.py,sha256=xnpFZJVlC2uoeeFW4zuPST8wA8ajaQDky5Y6iXZzi3A,172
10
- velocity/aws/handlers/context.py,sha256=saeK-2hpfbuOZvA76C1_2ZJSblPO_tDuKeaeDVfli1w,8052
10
+ velocity/aws/handlers/context.py,sha256=tLGpMJ0i1KQZAiOPHO1GGn9KKZ_Z8gzZmc0bWp97VG8,8200
11
11
  velocity/aws/handlers/lambda_handler.py,sha256=k8ZTj4vhuDbB9xinQ1-s7hKgx5JznldTNT3-udfMw04,6391
12
12
  velocity/aws/handlers/response.py,sha256=LXhtizLKnVBWjtHyE0h0bk-NYDrRpj7CHa7tRz9KkC4,9324
13
13
  velocity/aws/handlers/sqs_handler.py,sha256=nqt8NMOc5yO-L6CZo7NjgR8Q4KPKTDFBO-0eHu6oxkY,7149
@@ -49,8 +49,8 @@ velocity/misc/tools.py,sha256=_bGneHHA_BV-kUonzw5H3hdJ5AOJRCKfzhgpkFbGqIo,1502
49
49
  velocity/misc/conv/__init__.py,sha256=MLYF58QHjzfDSxb1rdnmLnuEQCa3gnhzzZ30CwZVvQo,40
50
50
  velocity/misc/conv/iconv.py,sha256=d4_BucW8HTIkGNurJ7GWrtuptqUf-9t79ObzjJ5N76U,10603
51
51
  velocity/misc/conv/oconv.py,sha256=h5Lo05DqOQnxoD3y6Px_MQP_V-pBbWf8Hkgkb9Xp1jk,6032
52
- velocity_python-0.0.115.dist-info/licenses/LICENSE,sha256=aoN245GG8s9oRUU89KNiGTU4_4OtnNmVi4hQeChg6rM,1076
53
- velocity_python-0.0.115.dist-info/METADATA,sha256=mH47xoUtbkjBSArI6QU7Mtx9qLjyPguYdAcVbPwtSLw,34262
54
- velocity_python-0.0.115.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
55
- velocity_python-0.0.115.dist-info/top_level.txt,sha256=JW2vJPmodgdgSz7H6yoZvnxF8S3fTMIv-YJWCT1sNW0,9
56
- velocity_python-0.0.115.dist-info/RECORD,,
52
+ velocity_python-0.0.116.dist-info/licenses/LICENSE,sha256=aoN245GG8s9oRUU89KNiGTU4_4OtnNmVi4hQeChg6rM,1076
53
+ velocity_python-0.0.116.dist-info/METADATA,sha256=781PKVf_fl9PmnetFsRQ7ZbdyhPVhqeFZ5i-gIsMqn8,34262
54
+ velocity_python-0.0.116.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
55
+ velocity_python-0.0.116.dist-info/top_level.txt,sha256=JW2vJPmodgdgSz7H6yoZvnxF8S3fTMIv-YJWCT1sNW0,9
56
+ velocity_python-0.0.116.dist-info/RECORD,,