velocity-python 0.0.142__py3-none-any.whl → 0.0.143__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 +12 -5
- velocity/db/servers/sqlserver/sql.py +9 -4
- {velocity_python-0.0.142.dist-info → velocity_python-0.0.143.dist-info}/METADATA +1 -1
- {velocity_python-0.0.142.dist-info → velocity_python-0.0.143.dist-info}/RECORD +8 -8
- {velocity_python-0.0.142.dist-info → velocity_python-0.0.143.dist-info}/WHEEL +0 -0
- {velocity_python-0.0.142.dist-info → velocity_python-0.0.143.dist-info}/licenses/LICENSE +0 -0
- {velocity_python-0.0.142.dist-info → velocity_python-0.0.143.dist-info}/top_level.txt +0 -0
velocity/__init__.py
CHANGED
|
@@ -794,7 +794,7 @@ class SQL(BaseSQLDialect):
|
|
|
794
794
|
return sql, tuple()
|
|
795
795
|
|
|
796
796
|
@classmethod
|
|
797
|
-
def ensure_sys_modified_count(cls, name):
|
|
797
|
+
def ensure_sys_modified_count(cls, name, has_column=False):
|
|
798
798
|
"""Return SQL to backfill sys_modified_count and refresh the on_sys_modified trigger."""
|
|
799
799
|
if "." in name:
|
|
800
800
|
fqtn = TableHelper.quote(name)
|
|
@@ -804,8 +804,13 @@ class SQL(BaseSQLDialect):
|
|
|
804
804
|
trigger_name = f"on_update_row_{fqtn.replace('.', '_')}"
|
|
805
805
|
column_name = TableHelper.quote("sys_modified_count")
|
|
806
806
|
|
|
807
|
-
|
|
808
|
-
|
|
807
|
+
statements = []
|
|
808
|
+
if not has_column:
|
|
809
|
+
statements.append(
|
|
810
|
+
f"ALTER TABLE {fqtn} ADD COLUMN {column_name} INTEGER NOT NULL DEFAULT 0;"
|
|
811
|
+
)
|
|
812
|
+
|
|
813
|
+
statements.extend([
|
|
809
814
|
f"UPDATE {fqtn} SET {column_name} = 0 WHERE {column_name} IS NULL;",
|
|
810
815
|
f"""
|
|
811
816
|
CREATE OR REPLACE FUNCTION {schema}.on_sys_modified()
|
|
@@ -843,9 +848,11 @@ class SQL(BaseSQLDialect):
|
|
|
843
848
|
BEFORE INSERT OR UPDATE ON {fqtn}
|
|
844
849
|
FOR EACH ROW EXECUTE PROCEDURE {schema}.on_sys_modified();
|
|
845
850
|
""",
|
|
846
|
-
|
|
851
|
+
])
|
|
847
852
|
|
|
848
|
-
sql = sqlparse.format(
|
|
853
|
+
sql = sqlparse.format(
|
|
854
|
+
" ".join(statements), reindent=True, keyword_case="upper"
|
|
855
|
+
)
|
|
849
856
|
return sql, tuple()
|
|
850
857
|
|
|
851
858
|
@classmethod
|
|
@@ -485,7 +485,7 @@ END;
|
|
|
485
485
|
return "\n".join(statements), tuple()
|
|
486
486
|
|
|
487
487
|
@classmethod
|
|
488
|
-
def ensure_sys_modified_count(cls, name):
|
|
488
|
+
def ensure_sys_modified_count(cls, name, has_column=False):
|
|
489
489
|
"""Ensure sys_modified_count exists for SQL Server tables along with maintenance triggers."""
|
|
490
490
|
if "." in name:
|
|
491
491
|
schema, table_name = name.split(".", 1)
|
|
@@ -499,8 +499,13 @@ END;
|
|
|
499
499
|
table_name_sql = table_name.replace("'", "''")
|
|
500
500
|
trigger_prefix = re.sub(r"[^0-9A-Za-z_]+", "_", f"CC_SYS_MOD_{table_name}")
|
|
501
501
|
|
|
502
|
-
statements = [
|
|
503
|
-
|
|
502
|
+
statements = []
|
|
503
|
+
if not has_column:
|
|
504
|
+
statements.append(
|
|
505
|
+
f"IF COL_LENGTH(N'{object_name}', 'sys_modified_count') IS NULL BEGIN ALTER TABLE {table_identifier} ADD sys_modified_count INT NOT NULL CONSTRAINT DF_{trigger_prefix}_COUNT DEFAULT (0); END;"
|
|
506
|
+
)
|
|
507
|
+
|
|
508
|
+
statements.extend([
|
|
504
509
|
f"UPDATE {table_identifier} SET sys_modified_count = 0 WHERE sys_modified_count IS NULL;",
|
|
505
510
|
f"IF OBJECT_ID(N'{schema_identifier}.{trigger_prefix}_insert', N'TR') IS NOT NULL DROP TRIGGER {schema_identifier}.{trigger_prefix}_insert;",
|
|
506
511
|
f"IF OBJECT_ID(N'{schema_identifier}.{trigger_prefix}_update', N'TR') IS NOT NULL DROP TRIGGER {schema_identifier}.{trigger_prefix}_update;",
|
|
@@ -539,7 +544,7 @@ BEGIN
|
|
|
539
544
|
INNER JOIN deleted AS d ON d.sys_id = i.sys_id;
|
|
540
545
|
END;
|
|
541
546
|
""".strip(),
|
|
542
|
-
]
|
|
547
|
+
])
|
|
543
548
|
|
|
544
549
|
return "\n".join(statements), tuple()
|
|
545
550
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
velocity/__init__.py,sha256=
|
|
1
|
+
velocity/__init__.py,sha256=7dxzsCMiwfjfVxitLuaVSt5R7L1gYDD6KOn-TRbGVhM,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=2U4w4H-lLVeX7zr5Evy1g_LrF9GCuNVGufIZJ6oBwfQ,50297
|
|
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
|
|
@@ -63,7 +63,7 @@ velocity/db/servers/sqlite/types.py,sha256=jpCJeV25x4Iytf6D6GXgK3hVYFAAFV4WKJC-d
|
|
|
63
63
|
velocity/db/servers/sqlserver/__init__.py,sha256=LN8OycN7W8da_ZPRYnPQ-O3Bv_xjret9qV1ZCitZlOU,2708
|
|
64
64
|
velocity/db/servers/sqlserver/operators.py,sha256=xK8_doDLssS38SRs1NoAI7XTO0-gNGMDS76nTVru4kE,1104
|
|
65
65
|
velocity/db/servers/sqlserver/reserved.py,sha256=Gn5n9DjxcjM-7PsIZPYigD6XLvMAYGnz1IrPuN7Dp2Y,2120
|
|
66
|
-
velocity/db/servers/sqlserver/sql.py,sha256=
|
|
66
|
+
velocity/db/servers/sqlserver/sql.py,sha256=O57p267LZ6WcAhxRuLuzylqjfZvDzkRuwf8s-GgeWDo,26332
|
|
67
67
|
velocity/db/servers/sqlserver/types.py,sha256=FAODYEO137m-WugpM89f9bQN9q6S2cjjUaz0a9gfE6M,3745
|
|
68
68
|
velocity/db/tests/__init__.py,sha256=7-hilWb43cKnSnCeXcjFG-6LpziN5k443IpsIvuevP0,24
|
|
69
69
|
velocity/db/tests/common_db_test.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -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.143.dist-info/licenses/LICENSE,sha256=aoN245GG8s9oRUU89KNiGTU4_4OtnNmVi4hQeChg6rM,1076
|
|
125
|
+
velocity_python-0.0.143.dist-info/METADATA,sha256=QYik2VnqgCBLUIaDB6ieHwzbEq53QtlbNjbOli--gko,34262
|
|
126
|
+
velocity_python-0.0.143.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
127
|
+
velocity_python-0.0.143.dist-info/top_level.txt,sha256=JW2vJPmodgdgSz7H6yoZvnxF8S3fTMIv-YJWCT1sNW0,9
|
|
128
|
+
velocity_python-0.0.143.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|