snowflake-code-unit-registry 0.7.6__tar.gz → 0.7.9__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.
- {snowflake_code_unit_registry-0.7.6 → snowflake_code_unit_registry-0.7.9}/Cargo.lock +27 -27
- {snowflake_code_unit_registry-0.7.6 → snowflake_code_unit_registry-0.7.9}/Cargo.toml +1 -1
- {snowflake_code_unit_registry-0.7.6 → snowflake_code_unit_registry-0.7.9}/PKG-INFO +1 -1
- {snowflake_code_unit_registry-0.7.6 → snowflake_code_unit_registry-0.7.9}/crates/scai-state-core/examples/code-unit.example.json +1 -0
- {snowflake_code_unit_registry-0.7.6 → snowflake_code_unit_registry-0.7.9}/crates/scai-state-core/schemas/code-unit.schema.json +5 -1
- {snowflake_code_unit_registry-0.7.6 → snowflake_code_unit_registry-0.7.9}/crates/scai-state-core/src/registry/tests.rs +52 -0
- {snowflake_code_unit_registry-0.7.6 → snowflake_code_unit_registry-0.7.9}/crates/scai-state-python/tests/test_serialization.py +65 -0
- {snowflake_code_unit_registry-0.7.6 → snowflake_code_unit_registry-0.7.9}/pyproject.toml +1 -1
- {snowflake_code_unit_registry-0.7.6 → snowflake_code_unit_registry-0.7.9}/python/snowflake_code_unit_registry/__init__.py +1 -1
- {snowflake_code_unit_registry-0.7.6 → snowflake_code_unit_registry-0.7.9}/python/snowflake_code_unit_registry/types.py +5 -0
- {snowflake_code_unit_registry-0.7.6 → snowflake_code_unit_registry-0.7.9}/README.md +0 -0
- {snowflake_code_unit_registry-0.7.6 → snowflake_code_unit_registry-0.7.9}/crates/scai-error-derive/Cargo.toml +0 -0
- {snowflake_code_unit_registry-0.7.6 → snowflake_code_unit_registry-0.7.9}/crates/scai-error-derive/src/lib.rs +0 -0
- {snowflake_code_unit_registry-0.7.6 → snowflake_code_unit_registry-0.7.9}/crates/scai-error-derive/tests/derive_integration.rs +0 -0
- {snowflake_code_unit_registry-0.7.6 → snowflake_code_unit_registry-0.7.9}/crates/scai-state-core/Cargo.toml +0 -0
- {snowflake_code_unit_registry-0.7.6 → snowflake_code_unit_registry-0.7.9}/crates/scai-state-core/build.rs +0 -0
- {snowflake_code_unit_registry-0.7.6 → snowflake_code_unit_registry-0.7.9}/crates/scai-state-core/schemas/history/README.md +0 -0
- {snowflake_code_unit_registry-0.7.6 → snowflake_code_unit_registry-0.7.9}/crates/scai-state-core/schemas/query-reference.rs.tmpl +0 -0
- {snowflake_code_unit_registry-0.7.6 → snowflake_code_unit_registry-0.7.9}/crates/scai-state-core/schemas/query-reference.tmpl +0 -0
- {snowflake_code_unit_registry-0.7.6 → snowflake_code_unit_registry-0.7.9}/crates/scai-state-core/src/canonical_name.rs +0 -0
- {snowflake_code_unit_registry-0.7.6 → snowflake_code_unit_registry-0.7.9}/crates/scai-state-core/src/checksum.rs +0 -0
- {snowflake_code_unit_registry-0.7.6 → snowflake_code_unit_registry-0.7.9}/crates/scai-state-core/src/error.rs +0 -0
- {snowflake_code_unit_registry-0.7.6 → snowflake_code_unit_registry-0.7.9}/crates/scai-state-core/src/error_trace.rs +0 -0
- {snowflake_code_unit_registry-0.7.6 → snowflake_code_unit_registry-0.7.9}/crates/scai-state-core/src/filter.rs +0 -0
- {snowflake_code_unit_registry-0.7.6 → snowflake_code_unit_registry-0.7.9}/crates/scai-state-core/src/generated/file_path_fields.rs +0 -0
- {snowflake_code_unit_registry-0.7.6 → snowflake_code_unit_registry-0.7.9}/crates/scai-state-core/src/generated/mod.rs +0 -0
- {snowflake_code_unit_registry-0.7.6 → snowflake_code_unit_registry-0.7.9}/crates/scai-state-core/src/generated/query_reference.rs +0 -0
- {snowflake_code_unit_registry-0.7.6 → snowflake_code_unit_registry-0.7.9}/crates/scai-state-core/src/generated/updated_at_paths.rs +0 -0
- {snowflake_code_unit_registry-0.7.6 → snowflake_code_unit_registry-0.7.9}/crates/scai-state-core/src/identity.rs +0 -0
- {snowflake_code_unit_registry-0.7.6 → snowflake_code_unit_registry-0.7.9}/crates/scai-state-core/src/lib.rs +0 -0
- {snowflake_code_unit_registry-0.7.6 → snowflake_code_unit_registry-0.7.9}/crates/scai-state-core/src/migration/mod.rs +0 -0
- {snowflake_code_unit_registry-0.7.6 → snowflake_code_unit_registry-0.7.9}/crates/scai-state-core/src/migration/versions/mod.rs +0 -0
- {snowflake_code_unit_registry-0.7.6 → snowflake_code_unit_registry-0.7.9}/crates/scai-state-core/src/registry/README.md +0 -0
- {snowflake_code_unit_registry-0.7.6 → snowflake_code_unit_registry-0.7.9}/crates/scai-state-core/src/registry/graph.rs +0 -0
- {snowflake_code_unit_registry-0.7.6 → snowflake_code_unit_registry-0.7.9}/crates/scai-state-core/src/registry/in_memory.rs +0 -0
- {snowflake_code_unit_registry-0.7.6 → snowflake_code_unit_registry-0.7.9}/crates/scai-state-core/src/registry/loader.rs +0 -0
- {snowflake_code_unit_registry-0.7.6 → snowflake_code_unit_registry-0.7.9}/crates/scai-state-core/src/registry/paths.rs +0 -0
- {snowflake_code_unit_registry-0.7.6 → snowflake_code_unit_registry-0.7.9}/crates/scai-state-core/src/registry/query.rs +0 -0
- {snowflake_code_unit_registry-0.7.6 → snowflake_code_unit_registry-0.7.9}/crates/scai-state-core/src/registry/test_helpers.rs +0 -0
- {snowflake_code_unit_registry-0.7.6 → snowflake_code_unit_registry-0.7.9}/crates/scai-state-core/src/registry.rs +0 -0
- {snowflake_code_unit_registry-0.7.6 → snowflake_code_unit_registry-0.7.9}/crates/scai-state-core/src/validation.rs +0 -0
- {snowflake_code_unit_registry-0.7.6 → snowflake_code_unit_registry-0.7.9}/crates/scai-state-python/Cargo.toml +0 -0
- {snowflake_code_unit_registry-0.7.6 → snowflake_code_unit_registry-0.7.9}/crates/scai-state-python/README.md +0 -0
- {snowflake_code_unit_registry-0.7.6 → snowflake_code_unit_registry-0.7.9}/crates/scai-state-python/src/lib.rs +0 -0
- {snowflake_code_unit_registry-0.7.6 → snowflake_code_unit_registry-0.7.9}/crates/scai-state-python/tests/conftest.py +0 -0
- {snowflake_code_unit_registry-0.7.6 → snowflake_code_unit_registry-0.7.9}/crates/scai-state-python/tests/test_batch.py +0 -0
- {snowflake_code_unit_registry-0.7.6 → snowflake_code_unit_registry-0.7.9}/crates/scai-state-python/tests/test_checksum.py +0 -0
- {snowflake_code_unit_registry-0.7.6 → snowflake_code_unit_registry-0.7.9}/crates/scai-state-python/tests/test_crud.py +0 -0
- {snowflake_code_unit_registry-0.7.6 → snowflake_code_unit_registry-0.7.9}/crates/scai-state-python/tests/test_errors.py +0 -0
- {snowflake_code_unit_registry-0.7.6 → snowflake_code_unit_registry-0.7.9}/crates/scai-state-python/tests/test_migration.py +0 -0
- {snowflake_code_unit_registry-0.7.6 → snowflake_code_unit_registry-0.7.9}/crates/scai-state-python/tests/test_query.py +0 -0
- {snowflake_code_unit_registry-0.7.6 → snowflake_code_unit_registry-0.7.9}/crates/scai-state-python/tests/test_refresh.py +0 -0
- {snowflake_code_unit_registry-0.7.6 → snowflake_code_unit_registry-0.7.9}/crates/scai-state-python/tests/test_validation.py +0 -0
|
@@ -69,9 +69,9 @@ checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8"
|
|
|
69
69
|
|
|
70
70
|
[[package]]
|
|
71
71
|
name = "aws-lc-rs"
|
|
72
|
-
version = "1.16.
|
|
72
|
+
version = "1.16.3"
|
|
73
73
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
74
|
-
checksum = "
|
|
74
|
+
checksum = "0ec6fb3fe69024a75fa7e1bfb48aa6cf59706a101658ea01bfd33b2b248a038f"
|
|
75
75
|
dependencies = [
|
|
76
76
|
"aws-lc-sys",
|
|
77
77
|
"zeroize",
|
|
@@ -79,9 +79,9 @@ dependencies = [
|
|
|
79
79
|
|
|
80
80
|
[[package]]
|
|
81
81
|
name = "aws-lc-sys"
|
|
82
|
-
version = "0.
|
|
82
|
+
version = "0.40.0"
|
|
83
83
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
84
|
-
checksum = "
|
|
84
|
+
checksum = "f50037ee5e1e41e7b8f9d161680a725bd1626cb6f8c7e901f91f942850852fe7"
|
|
85
85
|
dependencies = [
|
|
86
86
|
"cc",
|
|
87
87
|
"cmake",
|
|
@@ -309,9 +309,9 @@ dependencies = [
|
|
|
309
309
|
|
|
310
310
|
[[package]]
|
|
311
311
|
name = "ctor"
|
|
312
|
-
version = "0.
|
|
312
|
+
version = "0.10.0"
|
|
313
313
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
314
|
-
checksum = "
|
|
314
|
+
checksum = "95d0d11eb38e7642efca359c3cf6eb7b2e528182d09110165de70192b0352775"
|
|
315
315
|
dependencies = [
|
|
316
316
|
"ctor-proc-macro",
|
|
317
317
|
"dtor",
|
|
@@ -319,9 +319,9 @@ dependencies = [
|
|
|
319
319
|
|
|
320
320
|
[[package]]
|
|
321
321
|
name = "ctor-proc-macro"
|
|
322
|
-
version = "0.0.
|
|
322
|
+
version = "0.0.12"
|
|
323
323
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
324
|
-
checksum = "
|
|
324
|
+
checksum = "a7ab264ea985f1bd27887d7b21ea2bb046728e05d11909ca138d700c494730db"
|
|
325
325
|
|
|
326
326
|
[[package]]
|
|
327
327
|
name = "darling"
|
|
@@ -424,18 +424,18 @@ dependencies = [
|
|
|
424
424
|
|
|
425
425
|
[[package]]
|
|
426
426
|
name = "dtor"
|
|
427
|
-
version = "0.
|
|
427
|
+
version = "0.7.0"
|
|
428
428
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
429
|
-
checksum = "
|
|
429
|
+
checksum = "17f72721db8027a4e96dd6fb50d2a1d32259c9d3da1b63dee612ccd981e14293"
|
|
430
430
|
dependencies = [
|
|
431
431
|
"dtor-proc-macro",
|
|
432
432
|
]
|
|
433
433
|
|
|
434
434
|
[[package]]
|
|
435
435
|
name = "dtor-proc-macro"
|
|
436
|
-
version = "0.0.
|
|
436
|
+
version = "0.0.12"
|
|
437
437
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
438
|
-
checksum = "
|
|
438
|
+
checksum = "8c98b077c7463d01d22dde8a24378ddf1ca7263dc687cffbed38819ea6c21131"
|
|
439
439
|
|
|
440
440
|
[[package]]
|
|
441
441
|
name = "dunce"
|
|
@@ -1328,9 +1328,9 @@ dependencies = [
|
|
|
1328
1328
|
|
|
1329
1329
|
[[package]]
|
|
1330
1330
|
name = "napi"
|
|
1331
|
-
version = "3.8.
|
|
1331
|
+
version = "3.8.5"
|
|
1332
1332
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1333
|
-
checksum = "
|
|
1333
|
+
checksum = "fa73b028610e2b26e9e40bd2c8ff8a98e6d7ed5d67d89ebf4bfd2f992616b024"
|
|
1334
1334
|
dependencies = [
|
|
1335
1335
|
"bitflags",
|
|
1336
1336
|
"ctor",
|
|
@@ -1351,9 +1351,9 @@ checksum = "d376940fd5b723c6893cd1ee3f33abbfd86acb1cd1ec079f3ab04a2a3bc4d3b1"
|
|
|
1351
1351
|
|
|
1352
1352
|
[[package]]
|
|
1353
1353
|
name = "napi-derive"
|
|
1354
|
-
version = "3.5.
|
|
1354
|
+
version = "3.5.4"
|
|
1355
1355
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1356
|
-
checksum = "
|
|
1356
|
+
checksum = "7430702d3cc05cf55f0a2c9e41d991c3b7a53f91e6146a8f282b1bfc7f3fd133"
|
|
1357
1357
|
dependencies = [
|
|
1358
1358
|
"convert_case",
|
|
1359
1359
|
"ctor",
|
|
@@ -1365,9 +1365,9 @@ dependencies = [
|
|
|
1365
1365
|
|
|
1366
1366
|
[[package]]
|
|
1367
1367
|
name = "napi-derive-backend"
|
|
1368
|
-
version = "5.0.
|
|
1368
|
+
version = "5.0.3"
|
|
1369
1369
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1370
|
-
checksum = "
|
|
1370
|
+
checksum = "1ca5a083f2c9b49a0c7d33ec75c083498849c6fcc46f5497317faa39ea77f5d5"
|
|
1371
1371
|
dependencies = [
|
|
1372
1372
|
"convert_case",
|
|
1373
1373
|
"proc-macro2",
|
|
@@ -2100,7 +2100,7 @@ dependencies = [
|
|
|
2100
2100
|
|
|
2101
2101
|
[[package]]
|
|
2102
2102
|
name = "scai-error-derive"
|
|
2103
|
-
version = "0.7.
|
|
2103
|
+
version = "0.7.9"
|
|
2104
2104
|
dependencies = [
|
|
2105
2105
|
"err_code",
|
|
2106
2106
|
"heck",
|
|
@@ -2114,7 +2114,7 @@ dependencies = [
|
|
|
2114
2114
|
|
|
2115
2115
|
[[package]]
|
|
2116
2116
|
name = "scai-state-core"
|
|
2117
|
-
version = "0.7.
|
|
2117
|
+
version = "0.7.9"
|
|
2118
2118
|
dependencies = [
|
|
2119
2119
|
"chrono",
|
|
2120
2120
|
"err_code",
|
|
@@ -2139,7 +2139,7 @@ dependencies = [
|
|
|
2139
2139
|
|
|
2140
2140
|
[[package]]
|
|
2141
2141
|
name = "scai-state-csharp"
|
|
2142
|
-
version = "0.7.
|
|
2142
|
+
version = "0.7.9"
|
|
2143
2143
|
dependencies = [
|
|
2144
2144
|
"interoptopus",
|
|
2145
2145
|
"interoptopus_backend_csharp",
|
|
@@ -2150,7 +2150,7 @@ dependencies = [
|
|
|
2150
2150
|
|
|
2151
2151
|
[[package]]
|
|
2152
2152
|
name = "scai-state-node"
|
|
2153
|
-
version = "0.7.
|
|
2153
|
+
version = "0.7.9"
|
|
2154
2154
|
dependencies = [
|
|
2155
2155
|
"napi",
|
|
2156
2156
|
"napi-build",
|
|
@@ -2162,7 +2162,7 @@ dependencies = [
|
|
|
2162
2162
|
|
|
2163
2163
|
[[package]]
|
|
2164
2164
|
name = "scai-state-python"
|
|
2165
|
-
version = "0.7.
|
|
2165
|
+
version = "0.7.9"
|
|
2166
2166
|
dependencies = [
|
|
2167
2167
|
"pyo3",
|
|
2168
2168
|
"pythonize",
|
|
@@ -2797,9 +2797,9 @@ checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be"
|
|
|
2797
2797
|
|
|
2798
2798
|
[[package]]
|
|
2799
2799
|
name = "uuid"
|
|
2800
|
-
version = "1.23.
|
|
2800
|
+
version = "1.23.1"
|
|
2801
2801
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
2802
|
-
checksum = "
|
|
2802
|
+
checksum = "ddd74a9687298c6858e9b88ec8935ec45d22e8fd5e6394fa1bd4e99a87789c76"
|
|
2803
2803
|
dependencies = [
|
|
2804
2804
|
"getrandom 0.4.2",
|
|
2805
2805
|
"js-sys",
|
|
@@ -2972,9 +2972,9 @@ dependencies = [
|
|
|
2972
2972
|
|
|
2973
2973
|
[[package]]
|
|
2974
2974
|
name = "webpki-root-certs"
|
|
2975
|
-
version = "1.0.
|
|
2975
|
+
version = "1.0.7"
|
|
2976
2976
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
2977
|
-
checksum = "
|
|
2977
|
+
checksum = "f31141ce3fc3e300ae89b78c0dd67f9708061d1d2eda54b8209346fd6be9a92c"
|
|
2978
2978
|
dependencies = [
|
|
2979
2979
|
"rustls-pki-types",
|
|
2980
2980
|
]
|
|
@@ -3,7 +3,7 @@ resolver = "2"
|
|
|
3
3
|
members = ["crates/scai-error-derive", "crates/scai-state-core", "crates/scai-state-python"]
|
|
4
4
|
|
|
5
5
|
[workspace.package]
|
|
6
|
-
version = "0.7.
|
|
6
|
+
version = "0.7.9"
|
|
7
7
|
edition = "2021"
|
|
8
8
|
license = "SEE LICENSE IN LICENSE"
|
|
9
9
|
repository = "https://github.com/snowflake-eng/scai-state"
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"ObjectType": {
|
|
31
31
|
"type": "string",
|
|
32
32
|
"title": "ObjectType",
|
|
33
|
-
"enum": ["database", "schema", "table", "view", "materializedView", "function", "procedure", "stage", "udfHelper", "sequence", "tableType", "trigger", "other"],
|
|
33
|
+
"enum": ["database", "schema", "table", "view", "materializedView", "function", "procedure", "macro", "stage", "udfHelper", "sequence", "tableType", "trigger", "other"],
|
|
34
34
|
"description": "Type of database object"
|
|
35
35
|
},
|
|
36
36
|
"OperationStatus": {
|
|
@@ -379,6 +379,10 @@
|
|
|
379
379
|
"type": { "type": "string", "description": "Data type" },
|
|
380
380
|
"nullable": { "type": "boolean", "default": true },
|
|
381
381
|
"isPrimaryKey": { "type": "boolean", "description": "True if this column is part of the table's primary key" },
|
|
382
|
+
"isCaseSpecific": {
|
|
383
|
+
"type": "boolean",
|
|
384
|
+
"description": "True if column uses case-sensitive collation. False (or absent) means NOT CASESPECIFIC (Teradata default for CHAR/VARCHAR)."
|
|
385
|
+
},
|
|
382
386
|
"targetName": { "type": "string" },
|
|
383
387
|
"targetType": { "type": "string" }
|
|
384
388
|
}
|
|
@@ -882,6 +882,58 @@ fn test_example_json_roundtrip_fidelity() {
|
|
|
882
882
|
);
|
|
883
883
|
}
|
|
884
884
|
|
|
885
|
+
#[test]
|
|
886
|
+
fn test_object_type_macro_roundtrips() {
|
|
887
|
+
let dir = temp_dir();
|
|
888
|
+
let registry = CodeUnitRegistry::init(dir.path()).unwrap();
|
|
889
|
+
|
|
890
|
+
let mut cu = make_code_unit("macro-enum-001", "m1", CodeUnitObjectType::Macro);
|
|
891
|
+
registry.create(&mut cu, None).unwrap();
|
|
892
|
+
|
|
893
|
+
let loaded = registry.get_by_id("macro-enum-001", None).unwrap();
|
|
894
|
+
assert_eq!(
|
|
895
|
+
loaded.source.and_then(|s| s.object_type),
|
|
896
|
+
Some(CodeUnitObjectType::Macro)
|
|
897
|
+
);
|
|
898
|
+
assert_eq!(
|
|
899
|
+
loaded.target.and_then(|t| t.object_type),
|
|
900
|
+
Some(CodeUnitObjectType::Macro)
|
|
901
|
+
);
|
|
902
|
+
}
|
|
903
|
+
|
|
904
|
+
#[test]
|
|
905
|
+
fn test_loads_legacy_document_without_new_optional_fields() {
|
|
906
|
+
let dir = temp_dir();
|
|
907
|
+
let registry = CodeUnitRegistry::init(dir.path()).unwrap();
|
|
908
|
+
let legacy_id = "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa";
|
|
909
|
+
let path = dir.path().join("registry").join(format!("{legacy_id}.json"));
|
|
910
|
+
let json = r#"{
|
|
911
|
+
"schemaVersion": 1,
|
|
912
|
+
"kind": "databaseObject",
|
|
913
|
+
"id": "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa",
|
|
914
|
+
"source": {
|
|
915
|
+
"objectType": "procedure",
|
|
916
|
+
"database": "DB",
|
|
917
|
+
"schema": "dbo",
|
|
918
|
+
"name": "p1"
|
|
919
|
+
},
|
|
920
|
+
"target": {
|
|
921
|
+
"objectType": "procedure",
|
|
922
|
+
"database": "DB",
|
|
923
|
+
"schema": "DBO",
|
|
924
|
+
"name": "P1"
|
|
925
|
+
}
|
|
926
|
+
}"#;
|
|
927
|
+
fs::write(&path, json).unwrap();
|
|
928
|
+
|
|
929
|
+
let loaded = registry.get_by_id(legacy_id, None).unwrap();
|
|
930
|
+
assert_eq!(
|
|
931
|
+
loaded.source.and_then(|s| s.object_type),
|
|
932
|
+
Some(CodeUnitObjectType::Procedure)
|
|
933
|
+
);
|
|
934
|
+
assert!(loaded.signature.is_none());
|
|
935
|
+
}
|
|
936
|
+
|
|
885
937
|
/// Recursively inject `"required": [all property keys]` into every
|
|
886
938
|
/// JSON Schema object that has `"properties"`, including nested objects,
|
|
887
939
|
/// `definitions`, and array `items`. This turns an all-optional schema
|
|
@@ -114,6 +114,7 @@ def test_roundtrip_full_document(registry_dir: str):
|
|
|
114
114
|
type="DECIMAL(18,2)",
|
|
115
115
|
nullable=False,
|
|
116
116
|
isPrimaryKey=True,
|
|
117
|
+
isCaseSpecific=True,
|
|
117
118
|
targetName="REVENUE",
|
|
118
119
|
targetType="NUMBER(18,2)",
|
|
119
120
|
)
|
|
@@ -206,6 +207,7 @@ def test_roundtrip_full_document(registry_dir: str):
|
|
|
206
207
|
assert len(loaded.signature.columns) == 1
|
|
207
208
|
assert loaded.signature.columns[0].name == "Revenue"
|
|
208
209
|
assert loaded.signature.columns[0].isPrimaryKey is True
|
|
210
|
+
assert loaded.signature.columns[0].isCaseSpecific is True
|
|
209
211
|
assert len(loaded.signature.parameters.arguments) == 1
|
|
210
212
|
assert loaded.signature.parameters.arguments[0].name == "@StartDate"
|
|
211
213
|
assert len(loaded.signature.parameters.returns) == 1
|
|
@@ -251,6 +253,69 @@ def test_custom_code_status_phase_roundtrip(registry_dir: str):
|
|
|
251
253
|
assert dq["score"] == 95
|
|
252
254
|
|
|
253
255
|
|
|
256
|
+
def test_object_type_macro_roundtrips(registry_dir: str):
|
|
257
|
+
"""ObjectType.macro survives the Python <-> Rust round-trip."""
|
|
258
|
+
registry = CodeUnitRegistry.init(registry_dir)
|
|
259
|
+
|
|
260
|
+
original = CodeUnit(
|
|
261
|
+
id="macro-enum-001",
|
|
262
|
+
kind=Kind.databaseObject,
|
|
263
|
+
source=SourceMetadata.model_validate(
|
|
264
|
+
{
|
|
265
|
+
"objectType": ObjectType.macro,
|
|
266
|
+
"database": "DB",
|
|
267
|
+
"schema": "dbo",
|
|
268
|
+
"name": "m1",
|
|
269
|
+
}
|
|
270
|
+
),
|
|
271
|
+
target=TargetMetadata.model_validate(
|
|
272
|
+
{
|
|
273
|
+
"objectType": ObjectType.macro,
|
|
274
|
+
"database": "DB",
|
|
275
|
+
"schema": "DBO",
|
|
276
|
+
"name": "M1",
|
|
277
|
+
}
|
|
278
|
+
),
|
|
279
|
+
)
|
|
280
|
+
registry.create(original)
|
|
281
|
+
loaded = registry.get_by_id("macro-enum-001")
|
|
282
|
+
assert loaded.source.objectType == ObjectType.macro
|
|
283
|
+
assert loaded.target.objectType == ObjectType.macro
|
|
284
|
+
|
|
285
|
+
|
|
286
|
+
def test_loads_legacy_json_without_optional_signature_fields(registry_dir: str):
|
|
287
|
+
"""CUR files from older tooling may omit signature and newer optional columns fields."""
|
|
288
|
+
registry = CodeUnitRegistry.init(registry_dir)
|
|
289
|
+
legacy_id = "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa"
|
|
290
|
+
legacy_path = os.path.join(registry_dir, "registry", f"{legacy_id}.json")
|
|
291
|
+
with open(legacy_path, "w", encoding="utf-8") as f:
|
|
292
|
+
f.write(
|
|
293
|
+
"""
|
|
294
|
+
{
|
|
295
|
+
"schemaVersion": 1,
|
|
296
|
+
"kind": "databaseObject",
|
|
297
|
+
"id": "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa",
|
|
298
|
+
"source": {
|
|
299
|
+
"objectType": "procedure",
|
|
300
|
+
"database": "DB",
|
|
301
|
+
"schema": "dbo",
|
|
302
|
+
"name": "p1"
|
|
303
|
+
},
|
|
304
|
+
"target": {
|
|
305
|
+
"objectType": "procedure",
|
|
306
|
+
"database": "DB",
|
|
307
|
+
"schema": "DBO",
|
|
308
|
+
"name": "P1"
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
"""
|
|
312
|
+
)
|
|
313
|
+
|
|
314
|
+
loaded = registry.get_by_id(legacy_id)
|
|
315
|
+
assert loaded.source.objectType == ObjectType.procedure
|
|
316
|
+
assert loaded.signature is None
|
|
317
|
+
|
|
318
|
+
|
|
254
319
|
def test_extensions_roundtrip(registry_dir: str):
|
|
255
320
|
"""Verify that the extensions field (empty map by default) survives the
|
|
256
321
|
full round-trip. This is a regression guard for the build.rs fix that
|
|
@@ -74,6 +74,10 @@ class ColumnDef(BaseModel):
|
|
|
74
74
|
isPrimaryKey: bool | None = Field(
|
|
75
75
|
None, description="True if this column is part of the table's primary key"
|
|
76
76
|
)
|
|
77
|
+
isCaseSpecific: bool | None = Field(
|
|
78
|
+
None,
|
|
79
|
+
description='True if column uses case-sensitive collation. False (or absent) means NOT CASESPECIFIC (Teradata default for CHAR/VARCHAR).',
|
|
80
|
+
)
|
|
77
81
|
targetName: str | None = None
|
|
78
82
|
targetType: str | None = None
|
|
79
83
|
|
|
@@ -165,6 +169,7 @@ class ObjectType(Enum):
|
|
|
165
169
|
materializedView = 'materializedView'
|
|
166
170
|
function = 'function'
|
|
167
171
|
procedure = 'procedure'
|
|
172
|
+
macro = 'macro'
|
|
168
173
|
stage = 'stage'
|
|
169
174
|
udfHelper = 'udfHelper'
|
|
170
175
|
sequence = 'sequence'
|
|
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
|
|
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
|