velocity-python 0.0.117__tar.gz → 0.0.119__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.
Potentially problematic release.
This version of velocity-python might be problematic. Click here for more details.
- {velocity_python-0.0.117/src/velocity_python.egg-info → velocity_python-0.0.119}/PKG-INFO +1 -1
- {velocity_python-0.0.117 → velocity_python-0.0.119}/pyproject.toml +1 -1
- velocity_python-0.0.119/src/velocity/__init__.py +8 -0
- {velocity_python-0.0.117 → velocity_python-0.0.119}/src/velocity/aws/__init__.py +3 -0
- {velocity_python-0.0.117 → velocity_python-0.0.119}/src/velocity/aws/amplify.py +6 -7
- {velocity_python-0.0.117 → velocity_python-0.0.119}/src/velocity/aws/handlers/__init__.py +2 -0
- {velocity_python-0.0.117 → velocity_python-0.0.119}/src/velocity/aws/handlers/context.py +2 -2
- {velocity_python-0.0.117 → velocity_python-0.0.119}/src/velocity/aws/handlers/lambda_handler.py +4 -8
- {velocity_python-0.0.117 → velocity_python-0.0.119}/src/velocity/aws/handlers/response.py +1 -1
- {velocity_python-0.0.117 → velocity_python-0.0.119}/src/velocity/aws/handlers/sqs_handler.py +1 -6
- {velocity_python-0.0.117 → velocity_python-0.0.119}/src/velocity/db/__init__.py +15 -3
- {velocity_python-0.0.117 → velocity_python-0.0.119}/src/velocity/db/core/decorators.py +0 -1
- {velocity_python-0.0.117 → velocity_python-0.0.119}/src/velocity/db/core/engine.py +3 -5
- {velocity_python-0.0.117 → velocity_python-0.0.119}/src/velocity/db/core/result.py +0 -2
- {velocity_python-0.0.117 → velocity_python-0.0.119}/src/velocity/db/core/table.py +4 -4
- {velocity_python-0.0.117 → velocity_python-0.0.119}/src/velocity/db/servers/mysql.py +2 -3
- {velocity_python-0.0.117 → velocity_python-0.0.119}/src/velocity/db/servers/postgres/sql.py +4 -4
- {velocity_python-0.0.117 → velocity_python-0.0.119}/src/velocity/db/servers/sqlite.py +2 -2
- {velocity_python-0.0.117 → velocity_python-0.0.119}/src/velocity/db/servers/sqlserver.py +3 -3
- {velocity_python-0.0.117 → velocity_python-0.0.119}/src/velocity/db/utils.py +1 -1
- {velocity_python-0.0.117 → velocity_python-0.0.119}/src/velocity/misc/conv/__init__.py +2 -0
- {velocity_python-0.0.117 → velocity_python-0.0.119}/src/velocity/misc/conv/iconv.py +5 -4
- {velocity_python-0.0.117 → velocity_python-0.0.119}/src/velocity/misc/export.py +1 -4
- {velocity_python-0.0.117 → velocity_python-0.0.119}/src/velocity/misc/merge.py +1 -1
- {velocity_python-0.0.117 → velocity_python-0.0.119}/src/velocity/misc/tools.py +0 -1
- {velocity_python-0.0.117 → velocity_python-0.0.119/src/velocity_python.egg-info}/PKG-INFO +1 -1
- {velocity_python-0.0.117 → velocity_python-0.0.119}/src/velocity_python.egg-info/SOURCES.txt +0 -1
- velocity_python-0.0.117/src/velocity/__init__.py +0 -6
- velocity_python-0.0.117/src/velocity/db/core/exceptions.py +0 -73
- {velocity_python-0.0.117 → velocity_python-0.0.119}/LICENSE +0 -0
- {velocity_python-0.0.117 → velocity_python-0.0.119}/README.md +0 -0
- {velocity_python-0.0.117 → velocity_python-0.0.119}/setup.cfg +0 -0
- {velocity_python-0.0.117 → velocity_python-0.0.119}/src/velocity/app/__init__.py +0 -0
- {velocity_python-0.0.117 → velocity_python-0.0.119}/src/velocity/app/invoices.py +0 -0
- {velocity_python-0.0.117 → velocity_python-0.0.119}/src/velocity/app/orders.py +0 -0
- {velocity_python-0.0.117 → velocity_python-0.0.119}/src/velocity/app/payments.py +0 -0
- {velocity_python-0.0.117 → velocity_python-0.0.119}/src/velocity/app/purchase_orders.py +0 -0
- {velocity_python-0.0.117 → velocity_python-0.0.119}/src/velocity/aws/handlers/base_handler.py +0 -0
- {velocity_python-0.0.117 → velocity_python-0.0.119}/src/velocity/aws/handlers/exceptions.py +0 -0
- {velocity_python-0.0.117 → velocity_python-0.0.119}/src/velocity/db/core/__init__.py +0 -0
- {velocity_python-0.0.117 → velocity_python-0.0.119}/src/velocity/db/core/column.py +0 -0
- {velocity_python-0.0.117 → velocity_python-0.0.119}/src/velocity/db/core/database.py +0 -0
- {velocity_python-0.0.117 → velocity_python-0.0.119}/src/velocity/db/core/row.py +0 -0
- {velocity_python-0.0.117 → velocity_python-0.0.119}/src/velocity/db/core/sequence.py +0 -0
- {velocity_python-0.0.117 → velocity_python-0.0.119}/src/velocity/db/core/transaction.py +0 -0
- {velocity_python-0.0.117 → velocity_python-0.0.119}/src/velocity/db/exceptions.py +0 -0
- {velocity_python-0.0.117 → velocity_python-0.0.119}/src/velocity/db/servers/__init__.py +0 -0
- {velocity_python-0.0.117 → velocity_python-0.0.119}/src/velocity/db/servers/mysql_reserved.py +0 -0
- {velocity_python-0.0.117 → velocity_python-0.0.119}/src/velocity/db/servers/postgres/__init__.py +0 -0
- {velocity_python-0.0.117 → velocity_python-0.0.119}/src/velocity/db/servers/postgres/operators.py +0 -0
- {velocity_python-0.0.117 → velocity_python-0.0.119}/src/velocity/db/servers/postgres/reserved.py +0 -0
- {velocity_python-0.0.117 → velocity_python-0.0.119}/src/velocity/db/servers/postgres/types.py +0 -0
- {velocity_python-0.0.117 → velocity_python-0.0.119}/src/velocity/db/servers/sqlite_reserved.py +0 -0
- {velocity_python-0.0.117 → velocity_python-0.0.119}/src/velocity/db/servers/sqlserver_reserved.py +0 -0
- {velocity_python-0.0.117 → velocity_python-0.0.119}/src/velocity/db/servers/tablehelper.py +0 -0
- {velocity_python-0.0.117 → velocity_python-0.0.119}/src/velocity/misc/__init__.py +0 -0
- {velocity_python-0.0.117 → velocity_python-0.0.119}/src/velocity/misc/conv/oconv.py +0 -0
- {velocity_python-0.0.117 → velocity_python-0.0.119}/src/velocity/misc/db.py +0 -0
- {velocity_python-0.0.117 → velocity_python-0.0.119}/src/velocity/misc/format.py +0 -0
- {velocity_python-0.0.117 → velocity_python-0.0.119}/src/velocity/misc/mail.py +0 -0
- {velocity_python-0.0.117 → velocity_python-0.0.119}/src/velocity/misc/timer.py +0 -0
- {velocity_python-0.0.117 → velocity_python-0.0.119}/src/velocity_python.egg-info/dependency_links.txt +0 -0
- {velocity_python-0.0.117 → velocity_python-0.0.119}/src/velocity_python.egg-info/requires.txt +0 -0
- {velocity_python-0.0.117 → velocity_python-0.0.119}/src/velocity_python.egg-info/top_level.txt +0 -0
- {velocity_python-0.0.117 → velocity_python-0.0.119}/tests/test_cursor_rowcount_fix.py +0 -0
- {velocity_python-0.0.117 → velocity_python-0.0.119}/tests/test_db.py +0 -0
- {velocity_python-0.0.117 → velocity_python-0.0.119}/tests/test_db_utils.py +0 -0
- {velocity_python-0.0.117 → velocity_python-0.0.119}/tests/test_email_processing.py +0 -0
- {velocity_python-0.0.117 → velocity_python-0.0.119}/tests/test_fix.py +0 -0
- {velocity_python-0.0.117 → velocity_python-0.0.119}/tests/test_format.py +0 -0
- {velocity_python-0.0.117 → velocity_python-0.0.119}/tests/test_iconv.py +0 -0
- {velocity_python-0.0.117 → velocity_python-0.0.119}/tests/test_merge.py +0 -0
- {velocity_python-0.0.117 → velocity_python-0.0.119}/tests/test_oconv.py +0 -0
- {velocity_python-0.0.117 → velocity_python-0.0.119}/tests/test_original_error.py +0 -0
- {velocity_python-0.0.117 → velocity_python-0.0.119}/tests/test_payment_profile_sorting.py +0 -0
- {velocity_python-0.0.117 → velocity_python-0.0.119}/tests/test_postgres.py +0 -0
- {velocity_python-0.0.117 → velocity_python-0.0.119}/tests/test_process_error_robustness.py +0 -0
- {velocity_python-0.0.117 → velocity_python-0.0.119}/tests/test_response.py +0 -0
- {velocity_python-0.0.117 → velocity_python-0.0.119}/tests/test_result_caching.py +0 -0
- {velocity_python-0.0.117 → velocity_python-0.0.119}/tests/test_result_sql_aware.py +0 -0
- {velocity_python-0.0.117 → velocity_python-0.0.119}/tests/test_row_get_missing_column.py +0 -0
- {velocity_python-0.0.117 → velocity_python-0.0.119}/tests/test_spreadsheet_functions.py +0 -0
- {velocity_python-0.0.117 → velocity_python-0.0.119}/tests/test_sql_builder.py +0 -0
- {velocity_python-0.0.117 → velocity_python-0.0.119}/tests/test_tablehelper.py +0 -0
- {velocity_python-0.0.117 → velocity_python-0.0.119}/tests/test_timer.py +0 -0
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import boto3
|
|
2
|
+
import time
|
|
2
3
|
|
|
3
4
|
|
|
4
5
|
class AmplifyProject:
|
|
@@ -320,10 +321,10 @@ class AmplifyProject:
|
|
|
320
321
|
"Effect": "Allow",
|
|
321
322
|
"Resource": "*",
|
|
322
323
|
"Action": [
|
|
323
|
-
|
|
324
|
+
"ec2:DescribeInstances",
|
|
324
325
|
"ec2:CreateNetworkInterface",
|
|
325
326
|
"ec2:AttachNetworkInterface",
|
|
326
|
-
"ec2:DescribeNetworkInterfaces",
|
|
327
|
+
"ec2:DescribeNetworkInterfaces",
|
|
327
328
|
"ec2:DeleteNetworkInterface",
|
|
328
329
|
"ec2:DescribeSecurityGroups",
|
|
329
330
|
"ec2:AuthorizeSecurityGroupIngress",
|
|
@@ -394,10 +395,9 @@ class AmplifyProject:
|
|
|
394
395
|
except Exception:
|
|
395
396
|
pass
|
|
396
397
|
|
|
397
|
-
def check_policies(
|
|
398
|
-
self,
|
|
399
|
-
):
|
|
398
|
+
def check_policies(self, function):
|
|
400
399
|
# Attach a role policy
|
|
400
|
+
iam_client = boto3.client("iam")
|
|
401
401
|
response = iam_client.list_attached_role_policies(
|
|
402
402
|
RoleName=function["Role"].split("/")[1]
|
|
403
403
|
)
|
|
@@ -431,7 +431,7 @@ class AmplifyProject:
|
|
|
431
431
|
print(f"\n🔧 Applying {len(env_vars)} environment variables...")
|
|
432
432
|
for function_name in self.list_lambda_functions_filtered(branch):
|
|
433
433
|
print(f"➡️ Updating Lambda function: {function_name}")
|
|
434
|
-
self.
|
|
434
|
+
self.update_lambda_function(function_name, env_vars)
|
|
435
435
|
|
|
436
436
|
print(
|
|
437
437
|
"✅ Environment variables successfully applied to matching Lambda functions.\n"
|
|
@@ -440,7 +440,6 @@ class AmplifyProject:
|
|
|
440
440
|
|
|
441
441
|
def main():
|
|
442
442
|
app_id = "d3c209q3ri53mk"
|
|
443
|
-
branch = "demo"
|
|
444
443
|
app = AmplifyProject(app_id)
|
|
445
444
|
print(app.list_backend_branches())
|
|
446
445
|
|
|
@@ -196,7 +196,7 @@ class Context:
|
|
|
196
196
|
if isinstance(payload, dict):
|
|
197
197
|
payload = [payload]
|
|
198
198
|
messages = []
|
|
199
|
-
if user
|
|
199
|
+
if user is None:
|
|
200
200
|
user = self.session.get("email_address") or "EnqueueTasks"
|
|
201
201
|
for item in payload:
|
|
202
202
|
message = {"action": action, "payload": item}
|
|
@@ -216,7 +216,7 @@ class Context:
|
|
|
216
216
|
"batch_id": str(batch_id),
|
|
217
217
|
"job_id": id,
|
|
218
218
|
"status": "Initialized",
|
|
219
|
-
"message":
|
|
219
|
+
"message": "Job Initialized",
|
|
220
220
|
}
|
|
221
221
|
)
|
|
222
222
|
messages.append({"Id": id, "MessageBody": to_json(message)})
|
{velocity_python-0.0.117 → velocity_python-0.0.119}/src/velocity/aws/handlers/lambda_handler.py
RENAMED
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
from velocity.misc.format import to_json
|
|
2
1
|
import json
|
|
3
|
-
import sys
|
|
4
|
-
import os
|
|
5
|
-
import traceback
|
|
6
2
|
from velocity.aws.handlers.base_handler import BaseHandler
|
|
7
3
|
from velocity.aws.handlers.response import Response
|
|
8
|
-
from velocity.aws.handlers.exceptions import AlertError
|
|
9
4
|
from . import context
|
|
10
5
|
|
|
11
6
|
# TODO: helpers import needs to be resolved - may need to pass table name instead
|
|
@@ -54,7 +49,7 @@ class LambdaHandler(BaseHandler):
|
|
|
54
49
|
if isinstance(body, str) and len(body) > 0:
|
|
55
50
|
try:
|
|
56
51
|
postdata = json.loads(body)
|
|
57
|
-
except:
|
|
52
|
+
except (json.JSONDecodeError, TypeError):
|
|
58
53
|
postdata = {"raw_body": body}
|
|
59
54
|
elif isinstance(body, dict):
|
|
60
55
|
postdata = body
|
|
@@ -62,7 +57,7 @@ class LambdaHandler(BaseHandler):
|
|
|
62
57
|
try:
|
|
63
58
|
new = "\n".join(body)
|
|
64
59
|
postdata = json.loads(new)
|
|
65
|
-
except:
|
|
60
|
+
except (json.JSONDecodeError, TypeError):
|
|
66
61
|
postdata = {"raw_body": body}
|
|
67
62
|
|
|
68
63
|
req_params = self.aws_event.get("queryStringParameters") or {}
|
|
@@ -90,7 +85,8 @@ class LambdaHandler(BaseHandler):
|
|
|
90
85
|
"sys_modified_by": self.session["email_address"],
|
|
91
86
|
}
|
|
92
87
|
)
|
|
93
|
-
|
|
88
|
+
# TODO: Fix undefined helpers reference
|
|
89
|
+
# tx.table(helpers.get_tracking_table(user or self.session)).insert(data)
|
|
94
90
|
|
|
95
91
|
def OnActionDefault(self, tx, context):
|
|
96
92
|
context.response().set_body(
|
{velocity_python-0.0.117 → velocity_python-0.0.119}/src/velocity/aws/handlers/sqs_handler.py
RENAMED
|
@@ -6,15 +6,10 @@ It includes logging capabilities, action routing, and error handling.
|
|
|
6
6
|
"""
|
|
7
7
|
|
|
8
8
|
import json
|
|
9
|
-
import
|
|
10
|
-
import sys
|
|
11
|
-
import traceback
|
|
12
|
-
from typing import Any, Dict, Optional
|
|
9
|
+
from typing import Any, Dict
|
|
13
10
|
|
|
14
|
-
from velocity.aws import DEBUG
|
|
15
11
|
from velocity.aws.handlers import context as VelocityContext
|
|
16
12
|
from velocity.aws.handlers.base_handler import BaseHandler
|
|
17
|
-
from velocity.misc.format import to_json
|
|
18
13
|
|
|
19
14
|
|
|
20
15
|
class SqsHandler(BaseHandler):
|
|
@@ -5,9 +5,6 @@ from velocity.db.servers import sqlite
|
|
|
5
5
|
from velocity.db.servers import sqlserver
|
|
6
6
|
from velocity.db import utils
|
|
7
7
|
|
|
8
|
-
# Export exceptions at the package level for backward compatibility
|
|
9
|
-
from velocity.db.exceptions import *
|
|
10
|
-
|
|
11
8
|
# Export commonly used utility functions
|
|
12
9
|
from velocity.db.utils import (
|
|
13
10
|
safe_sort_rows,
|
|
@@ -17,3 +14,18 @@ from velocity.db.utils import (
|
|
|
17
14
|
group_by_fields,
|
|
18
15
|
safe_sort_grouped_rows,
|
|
19
16
|
)
|
|
17
|
+
|
|
18
|
+
__all__ = [
|
|
19
|
+
"exceptions",
|
|
20
|
+
"postgres",
|
|
21
|
+
"mysql",
|
|
22
|
+
"sqlite",
|
|
23
|
+
"sqlserver",
|
|
24
|
+
"utils",
|
|
25
|
+
"safe_sort_rows",
|
|
26
|
+
"safe_sort_key_none_last",
|
|
27
|
+
"safe_sort_key_none_first",
|
|
28
|
+
"safe_sort_key_with_default",
|
|
29
|
+
"group_by_fields",
|
|
30
|
+
"safe_sort_grouped_rows",
|
|
31
|
+
]
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import inspect
|
|
2
|
-
import sys
|
|
3
2
|
import re
|
|
4
|
-
import traceback
|
|
5
3
|
from functools import wraps
|
|
6
4
|
from velocity.db import exceptions
|
|
7
5
|
from velocity.db.core.transaction import Transaction
|
|
@@ -176,18 +174,18 @@ class Engine:
|
|
|
176
174
|
while True:
|
|
177
175
|
try:
|
|
178
176
|
return function(*args, **kwds)
|
|
179
|
-
except exceptions.DbRetryTransaction
|
|
177
|
+
except exceptions.DbRetryTransaction:
|
|
180
178
|
retry_count += 1
|
|
181
179
|
if retry_count > self.MAX_RETRIES:
|
|
182
180
|
raise
|
|
183
181
|
_tx.rollback()
|
|
184
|
-
except exceptions.DbLockTimeoutError
|
|
182
|
+
except exceptions.DbLockTimeoutError:
|
|
185
183
|
lock_timeout_count += 1
|
|
186
184
|
if lock_timeout_count > self.MAX_RETRIES:
|
|
187
185
|
raise
|
|
188
186
|
_tx.rollback()
|
|
189
187
|
continue
|
|
190
|
-
except:
|
|
188
|
+
except Exception:
|
|
191
189
|
raise
|
|
192
190
|
finally:
|
|
193
191
|
setattr(_tx, "_exec_function_depth", depth)
|
|
@@ -54,13 +54,13 @@ class Table:
|
|
|
54
54
|
"""
|
|
55
55
|
try:
|
|
56
56
|
self._cursor.close()
|
|
57
|
-
except:
|
|
57
|
+
except Exception:
|
|
58
58
|
pass
|
|
59
59
|
|
|
60
60
|
def cursor(self):
|
|
61
61
|
try:
|
|
62
62
|
return self._cursor
|
|
63
|
-
except:
|
|
63
|
+
except AttributeError:
|
|
64
64
|
pass
|
|
65
65
|
self._cursor = self.tx.cursor()
|
|
66
66
|
return self._cursor
|
|
@@ -887,8 +887,8 @@ class Table:
|
|
|
887
887
|
# Return a descriptive string of differences.
|
|
888
888
|
if differences:
|
|
889
889
|
differences.insert(0, f"Comparing {self.name}: {pk1} vs {pk2}")
|
|
890
|
-
differences.insert(0,
|
|
891
|
-
differences.append(
|
|
890
|
+
differences.insert(0, "--------------------------------------")
|
|
891
|
+
differences.append("--------------------------------------")
|
|
892
892
|
return "\n".join(differences)
|
|
893
893
|
else:
|
|
894
894
|
return f"{self.name} rows {pk1} and {pk2} are identical."
|
|
@@ -30,7 +30,7 @@ def make_where(where, sql, vals, is_join=False):
|
|
|
30
30
|
if is_join:
|
|
31
31
|
if "." not in key:
|
|
32
32
|
key = "A." + key
|
|
33
|
-
if val
|
|
33
|
+
if val is None:
|
|
34
34
|
if "!" in key:
|
|
35
35
|
key = key.replace("!", "")
|
|
36
36
|
sql.append("{} is not NULL".format(quote(key.lower())))
|
|
@@ -198,7 +198,7 @@ class SQL:
|
|
|
198
198
|
cls, table, columns, key_to_table, key_to_columns, name=None, schema=None
|
|
199
199
|
):
|
|
200
200
|
if "." not in table and schema:
|
|
201
|
-
if schema
|
|
201
|
+
if schema is None:
|
|
202
202
|
schema = cls.default_schema
|
|
203
203
|
table = "{}.{}".format(schema, table)
|
|
204
204
|
if isinstance(key_to_columns, str):
|
|
@@ -254,7 +254,6 @@ class SQL:
|
|
|
254
254
|
|
|
255
255
|
@classmethod
|
|
256
256
|
def create_table(cls, name, columns={}, drop=False):
|
|
257
|
-
trigger = "".format(name)
|
|
258
257
|
sql = []
|
|
259
258
|
if drop:
|
|
260
259
|
sql.append(cls.drop_table(name))
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import re
|
|
2
2
|
import hashlib
|
|
3
3
|
import sqlparse
|
|
4
|
-
from psycopg2 import sql
|
|
4
|
+
from psycopg2 import sql as psycopg2_sql
|
|
5
5
|
|
|
6
6
|
from velocity.db import exceptions
|
|
7
7
|
|
|
@@ -985,7 +985,7 @@ class SQL:
|
|
|
985
985
|
columns = TableHelper.quote(columns)
|
|
986
986
|
sql = ["DROP"]
|
|
987
987
|
sql.append("INDEX IF EXISTS")
|
|
988
|
-
|
|
988
|
+
_tablename = TableHelper.quote(table)
|
|
989
989
|
if not name:
|
|
990
990
|
name = re.sub(
|
|
991
991
|
r"\([^)]*\)",
|
|
@@ -1155,9 +1155,9 @@ class SQL:
|
|
|
1155
1155
|
@classmethod
|
|
1156
1156
|
def missing(cls, tx, table, list, column="SYS_ID", where=None):
|
|
1157
1157
|
sql = [
|
|
1158
|
-
|
|
1158
|
+
"SELECT * FROM",
|
|
1159
1159
|
f"UNNEST('{{{','.join([str(x) for x in list])}}}'::int[]) id",
|
|
1160
|
-
|
|
1160
|
+
"EXCEPT ALL",
|
|
1161
1161
|
f"SELECT {column} FROM {table}",
|
|
1162
1162
|
]
|
|
1163
1163
|
vals = []
|
|
@@ -216,7 +216,7 @@ class SQL(object):
|
|
|
216
216
|
if is_join:
|
|
217
217
|
if "." not in key:
|
|
218
218
|
key = "A." + key
|
|
219
|
-
if val
|
|
219
|
+
if val is None:
|
|
220
220
|
if "!" in key:
|
|
221
221
|
key = key.replace("!", "")
|
|
222
222
|
sql.append("{} is not NULL".format(quote(key.lower())))
|
|
@@ -919,7 +919,7 @@ class SQL(object):
|
|
|
919
919
|
for key in sorted(where.keys()):
|
|
920
920
|
if join:
|
|
921
921
|
sql.append(join)
|
|
922
|
-
if where[key]
|
|
922
|
+
if where[key] is None:
|
|
923
923
|
sql.append("{} is NULL".format(quote(key.lower())))
|
|
924
924
|
else:
|
|
925
925
|
sql.append("{} = ?".format(quote(key.lower())))
|
|
@@ -30,7 +30,7 @@ def make_where(where, sql, vals, is_join=False):
|
|
|
30
30
|
if is_join:
|
|
31
31
|
if "." not in key:
|
|
32
32
|
key = "A." + key
|
|
33
|
-
if val
|
|
33
|
+
if val is None:
|
|
34
34
|
if "!" in key:
|
|
35
35
|
key = key.replace("!", "")
|
|
36
36
|
sql.append("{} is not NULL".format(quote(key.lower())))
|
|
@@ -394,7 +394,7 @@ class SQL:
|
|
|
394
394
|
cls, table, columns, key_to_table, key_to_columns, name=None, schema=None
|
|
395
395
|
):
|
|
396
396
|
if "." not in table and schema:
|
|
397
|
-
if schema
|
|
397
|
+
if schema is None:
|
|
398
398
|
schema = cls.default_schema
|
|
399
399
|
table = "{}.{}".format(schema, table)
|
|
400
400
|
if isinstance(key_to_columns, str):
|
|
@@ -873,7 +873,7 @@ class SQL:
|
|
|
873
873
|
for key in sorted(where.keys()):
|
|
874
874
|
if join:
|
|
875
875
|
sql.append(join)
|
|
876
|
-
if where[key]
|
|
876
|
+
if where[key] is None:
|
|
877
877
|
sql.append("{} is NULL".format(quote(key.lower())))
|
|
878
878
|
else:
|
|
879
879
|
sql.append("{} = %s".format(quote(key.lower())))
|
|
@@ -5,7 +5,7 @@ This module provides utility functions to handle common database operations
|
|
|
5
5
|
safely, including sorting with None values and other edge cases.
|
|
6
6
|
"""
|
|
7
7
|
|
|
8
|
-
from typing import Any, Callable, List
|
|
8
|
+
from typing import Any, Callable, List
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
def safe_sort_key_none_last(field_name: str) -> Callable[[dict], tuple]:
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import re
|
|
2
2
|
import ast
|
|
3
3
|
import codecs
|
|
4
|
+
import decimal
|
|
4
5
|
from decimal import Decimal, ROUND_HALF_UP
|
|
5
6
|
from email.utils import parseaddr
|
|
6
7
|
from datetime import datetime
|
|
@@ -224,7 +225,7 @@ def money(data: str) -> Optional[Decimal]:
|
|
|
224
225
|
return None
|
|
225
226
|
try:
|
|
226
227
|
return Decimal(cleaned)
|
|
227
|
-
except:
|
|
228
|
+
except (ValueError, TypeError, decimal.InvalidOperation):
|
|
228
229
|
return None
|
|
229
230
|
|
|
230
231
|
|
|
@@ -246,7 +247,7 @@ def round_to(
|
|
|
246
247
|
cleaned = re.sub(r"[^0-9\.\-+]", "", val_str)
|
|
247
248
|
try:
|
|
248
249
|
as_dec = Decimal(cleaned)
|
|
249
|
-
except:
|
|
250
|
+
except (ValueError, TypeError, decimal.InvalidOperation):
|
|
250
251
|
return None
|
|
251
252
|
return as_dec.quantize(Decimal(10) ** -precision, rounding=ROUND_HALF_UP)
|
|
252
253
|
|
|
@@ -269,7 +270,7 @@ def decimal_val(data: str) -> Optional[Decimal]:
|
|
|
269
270
|
return None
|
|
270
271
|
try:
|
|
271
272
|
return Decimal(cleaned)
|
|
272
|
-
except:
|
|
273
|
+
except (ValueError, TypeError, decimal.InvalidOperation):
|
|
273
274
|
return None
|
|
274
275
|
|
|
275
276
|
|
|
@@ -305,7 +306,7 @@ def to_list(data: Union[str, list, None]) -> Optional[list]:
|
|
|
305
306
|
if data_str.startswith("[") and data_str.endswith("]"):
|
|
306
307
|
try:
|
|
307
308
|
return ast.literal_eval(data_str)
|
|
308
|
-
except:
|
|
309
|
+
except (ValueError, SyntaxError):
|
|
309
310
|
return [data_str] # fallback: treat as a single string
|
|
310
311
|
return [data_str]
|
|
311
312
|
|
{velocity_python-0.0.117 → velocity_python-0.0.119}/src/velocity_python.egg-info/SOURCES.txt
RENAMED
|
@@ -24,7 +24,6 @@ src/velocity/db/core/column.py
|
|
|
24
24
|
src/velocity/db/core/database.py
|
|
25
25
|
src/velocity/db/core/decorators.py
|
|
26
26
|
src/velocity/db/core/engine.py
|
|
27
|
-
src/velocity/db/core/exceptions.py
|
|
28
27
|
src/velocity/db/core/result.py
|
|
29
28
|
src/velocity/db/core/row.py
|
|
30
29
|
src/velocity/db/core/sequence.py
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
class DbException(Exception):
|
|
2
|
-
pass
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
class DbApplicationError(DbException):
|
|
6
|
-
pass
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
class DbForeignKeyMissingError(DbException):
|
|
10
|
-
pass
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
class DbDatabaseMissingError(DbException):
|
|
14
|
-
pass
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
class DbTableMissingError(DbException):
|
|
18
|
-
pass
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
class DbColumnMissingError(DbException):
|
|
22
|
-
pass
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
class DbTruncationError(DbException):
|
|
26
|
-
pass
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
class DbConnectionError(DbException):
|
|
30
|
-
pass
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
class DbDuplicateKeyError(DbException):
|
|
34
|
-
pass
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
class DbObjectExistsError(DbException):
|
|
38
|
-
pass
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
class DbLockTimeoutError(DbException):
|
|
42
|
-
pass
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
class DbRetryTransaction(DbException):
|
|
46
|
-
pass
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
class DbDataIntegrityError(DbException):
|
|
50
|
-
pass
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
class DuplicateRowsFoundError(Exception):
|
|
54
|
-
pass
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
class DbQueryError(DbException):
|
|
58
|
-
"""Database query error"""
|
|
59
|
-
|
|
60
|
-
pass
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
class DbTransactionError(DbException):
|
|
64
|
-
"""Database transaction error"""
|
|
65
|
-
|
|
66
|
-
pass
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
# Add aliases for backward compatibility with engine.py
|
|
70
|
-
class DatabaseError(DbException):
|
|
71
|
-
"""Generic database error - alias for DbException"""
|
|
72
|
-
|
|
73
|
-
pass
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{velocity_python-0.0.117 → velocity_python-0.0.119}/src/velocity/aws/handlers/base_handler.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{velocity_python-0.0.117 → velocity_python-0.0.119}/src/velocity/db/servers/mysql_reserved.py
RENAMED
|
File without changes
|
{velocity_python-0.0.117 → velocity_python-0.0.119}/src/velocity/db/servers/postgres/__init__.py
RENAMED
|
File without changes
|
{velocity_python-0.0.117 → velocity_python-0.0.119}/src/velocity/db/servers/postgres/operators.py
RENAMED
|
File without changes
|
{velocity_python-0.0.117 → velocity_python-0.0.119}/src/velocity/db/servers/postgres/reserved.py
RENAMED
|
File without changes
|
{velocity_python-0.0.117 → velocity_python-0.0.119}/src/velocity/db/servers/postgres/types.py
RENAMED
|
File without changes
|
{velocity_python-0.0.117 → velocity_python-0.0.119}/src/velocity/db/servers/sqlite_reserved.py
RENAMED
|
File without changes
|
{velocity_python-0.0.117 → velocity_python-0.0.119}/src/velocity/db/servers/sqlserver_reserved.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{velocity_python-0.0.117 → velocity_python-0.0.119}/src/velocity_python.egg-info/requires.txt
RENAMED
|
File without changes
|
{velocity_python-0.0.117 → velocity_python-0.0.119}/src/velocity_python.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|