velocity-python 0.0.143__py3-none-any.whl → 0.0.144__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 +1 -1
- velocity/db/servers/postgres/sql.py +20 -43
- {velocity_python-0.0.143.dist-info → velocity_python-0.0.144.dist-info}/METADATA +1 -1
- {velocity_python-0.0.143.dist-info → velocity_python-0.0.144.dist-info}/RECORD +7 -7
- {velocity_python-0.0.143.dist-info → velocity_python-0.0.144.dist-info}/WHEEL +0 -0
- {velocity_python-0.0.143.dist-info → velocity_python-0.0.144.dist-info}/licenses/LICENSE +0 -0
- {velocity_python-0.0.143.dist-info → velocity_python-0.0.144.dist-info}/top_level.txt +0 -0
velocity/__init__.py
CHANGED
|
@@ -18,39 +18,6 @@ TableHelper.reserved = reserved_words
|
|
|
18
18
|
TableHelper.operators = OPERATORS
|
|
19
19
|
|
|
20
20
|
|
|
21
|
-
def _get_table_helper(tx, table):
|
|
22
|
-
"""
|
|
23
|
-
Utility function to create a TableHelper instance.
|
|
24
|
-
Ensures consistent configuration across all SQL methods.
|
|
25
|
-
"""
|
|
26
|
-
return TableHelper(tx, table)
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
def _validate_table_name(table):
|
|
30
|
-
"""Validate table name format."""
|
|
31
|
-
if not table or not isinstance(table, str):
|
|
32
|
-
raise ValueError("Table name must be a non-empty string")
|
|
33
|
-
# Add more validation as needed
|
|
34
|
-
return table.strip()
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
def _handle_predicate_errors(predicates, operation="WHERE"):
|
|
38
|
-
"""Process a list of predicates with error handling."""
|
|
39
|
-
sql_parts = []
|
|
40
|
-
vals = []
|
|
41
|
-
|
|
42
|
-
for pred, val in predicates:
|
|
43
|
-
sql_parts.append(pred)
|
|
44
|
-
if val is None:
|
|
45
|
-
pass
|
|
46
|
-
elif isinstance(val, tuple):
|
|
47
|
-
vals.extend(val)
|
|
48
|
-
else:
|
|
49
|
-
vals.append(val)
|
|
50
|
-
|
|
51
|
-
return sql_parts, vals
|
|
52
|
-
|
|
53
|
-
|
|
54
21
|
system_fields = [
|
|
55
22
|
"sys_id",
|
|
56
23
|
"sys_created",
|
|
@@ -143,7 +110,7 @@ class SQL(BaseSQLDialect):
|
|
|
143
110
|
vals = []
|
|
144
111
|
|
|
145
112
|
# Create table helper instance
|
|
146
|
-
th =
|
|
113
|
+
th = TableHelper(tx, table)
|
|
147
114
|
|
|
148
115
|
# Handle columns and DISTINCT before aliasing
|
|
149
116
|
if columns is None:
|
|
@@ -447,7 +414,7 @@ class SQL(BaseSQLDialect):
|
|
|
447
414
|
if not isinstance(data, Mapping) or not data:
|
|
448
415
|
raise ValueError("data must be a non-empty mapping of column-value pairs.")
|
|
449
416
|
|
|
450
|
-
th =
|
|
417
|
+
th = TableHelper(tx, table)
|
|
451
418
|
set_clauses = []
|
|
452
419
|
vals = []
|
|
453
420
|
|
|
@@ -797,11 +764,21 @@ class SQL(BaseSQLDialect):
|
|
|
797
764
|
def ensure_sys_modified_count(cls, name, has_column=False):
|
|
798
765
|
"""Return SQL to backfill sys_modified_count and refresh the on_sys_modified trigger."""
|
|
799
766
|
if "." in name:
|
|
800
|
-
|
|
767
|
+
schema_name, table_name = name.split(".", 1)
|
|
801
768
|
else:
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
769
|
+
schema_name = cls.default_schema
|
|
770
|
+
table_name = name
|
|
771
|
+
|
|
772
|
+
schema_identifier = TableHelper.quote(schema_name)
|
|
773
|
+
table_identifier = TableHelper.quote(table_name)
|
|
774
|
+
fqtn = f"{schema_identifier}.{table_identifier}"
|
|
775
|
+
|
|
776
|
+
trigger_name = (
|
|
777
|
+
f"on_update_row_{schema_name}_{table_name}"
|
|
778
|
+
.replace(".", "_")
|
|
779
|
+
.replace('"', "")
|
|
780
|
+
)
|
|
781
|
+
trigger_identifier = TableHelper.quote(trigger_name)
|
|
805
782
|
column_name = TableHelper.quote("sys_modified_count")
|
|
806
783
|
|
|
807
784
|
statements = []
|
|
@@ -813,7 +790,7 @@ class SQL(BaseSQLDialect):
|
|
|
813
790
|
statements.extend([
|
|
814
791
|
f"UPDATE {fqtn} SET {column_name} = 0 WHERE {column_name} IS NULL;",
|
|
815
792
|
f"""
|
|
816
|
-
CREATE OR REPLACE FUNCTION {
|
|
793
|
+
CREATE OR REPLACE FUNCTION {schema_identifier}.on_sys_modified()
|
|
817
794
|
RETURNS TRIGGER AS
|
|
818
795
|
$BODY$
|
|
819
796
|
BEGIN
|
|
@@ -842,11 +819,11 @@ class SQL(BaseSQLDialect):
|
|
|
842
819
|
LANGUAGE plpgsql VOLATILE
|
|
843
820
|
COST 100;
|
|
844
821
|
""",
|
|
845
|
-
f"DROP TRIGGER IF EXISTS {
|
|
822
|
+
f"DROP TRIGGER IF EXISTS {trigger_identifier} ON {fqtn};",
|
|
846
823
|
f"""
|
|
847
|
-
CREATE TRIGGER {
|
|
824
|
+
CREATE TRIGGER {trigger_identifier}
|
|
848
825
|
BEFORE INSERT OR UPDATE ON {fqtn}
|
|
849
|
-
FOR EACH ROW EXECUTE PROCEDURE {
|
|
826
|
+
FOR EACH ROW EXECUTE PROCEDURE {schema_identifier}.on_sys_modified();
|
|
850
827
|
""",
|
|
851
828
|
])
|
|
852
829
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
velocity/__init__.py,sha256=
|
|
1
|
+
velocity/__init__.py,sha256=Ioy0BZtv2G_FlLD37UBlDUKHraQfoj2Xa6dDuiWKnk0,147
|
|
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=fr1oTBjSFfyeMBUXRG06LV4jgwrlwYNL5mbEBleFwf0,6328
|
|
@@ -53,7 +53,7 @@ velocity/db/servers/mysql/types.py,sha256=BMQf4TpsRo1JN-yOl1nSItTO-Juu2piSTNy5o_
|
|
|
53
53
|
velocity/db/servers/postgres/__init__.py,sha256=6YcTLXposmsrEaJgdUAM_QgD1TZDSILQrGcwWZ-dibk,2457
|
|
54
54
|
velocity/db/servers/postgres/operators.py,sha256=y9k6enReeR5hJxU_lYYR2epoaw4qCxEqmYJJ5jjaVWA,1166
|
|
55
55
|
velocity/db/servers/postgres/reserved.py,sha256=5tKLaqFV-HrWRj-nsrxl5KGbmeM3ukn_bPZK36XEu8M,3648
|
|
56
|
-
velocity/db/servers/postgres/sql.py,sha256=
|
|
56
|
+
velocity/db/servers/postgres/sql.py,sha256=qUzZE45pfvB4499W1UfpqvupKP1RuQyOrRmB1oJ6sJY,49791
|
|
57
57
|
velocity/db/servers/postgres/types.py,sha256=W71x8iRx-IIJkQSjb29k-KGkqp-QS6SxB0BHYXd4k8w,6955
|
|
58
58
|
velocity/db/servers/sqlite/__init__.py,sha256=EIx09YN1-Vm-4CXVcEf9DBgvd8FhIN9rEqIaSRrEcIk,2293
|
|
59
59
|
velocity/db/servers/sqlite/operators.py,sha256=VzZgph8RrnHkIVqqWGqnJwcafgBzc_8ZQp-M8tMl-mw,1221
|
|
@@ -121,8 +121,8 @@ velocity/misc/tests/test_merge.py,sha256=Vm5_jY5cVczw0hZF-3TYzmxFw81heJOJB-dvhCg
|
|
|
121
121
|
velocity/misc/tests/test_oconv.py,sha256=fy4DwWGn_v486r2d_3ACpuBD-K1oOngNq1HJCGH7X-M,4694
|
|
122
122
|
velocity/misc/tests/test_original_error.py,sha256=iWSd18tckOA54LoPQOGV5j9LAz2W-3_ZOwmyZ8-4YQc,1742
|
|
123
123
|
velocity/misc/tests/test_timer.py,sha256=l9nrF84kHaFofvQYKInJmfoqC01wBhsUB18lVBgXCoo,2758
|
|
124
|
-
velocity_python-0.0.
|
|
125
|
-
velocity_python-0.0.
|
|
126
|
-
velocity_python-0.0.
|
|
127
|
-
velocity_python-0.0.
|
|
128
|
-
velocity_python-0.0.
|
|
124
|
+
velocity_python-0.0.144.dist-info/licenses/LICENSE,sha256=aoN245GG8s9oRUU89KNiGTU4_4OtnNmVi4hQeChg6rM,1076
|
|
125
|
+
velocity_python-0.0.144.dist-info/METADATA,sha256=imAkzFidVZzVoPKOvVLgKimeWssXCWGfzB9dZH6FTD8,34262
|
|
126
|
+
velocity_python-0.0.144.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
127
|
+
velocity_python-0.0.144.dist-info/top_level.txt,sha256=JW2vJPmodgdgSz7H6yoZvnxF8S3fTMIv-YJWCT1sNW0,9
|
|
128
|
+
velocity_python-0.0.144.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|