clickzetta-semantic-model-generator 1.0.9__py3-none-any.whl → 1.0.11__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.
- {clickzetta_semantic_model_generator-1.0.9.dist-info → clickzetta_semantic_model_generator-1.0.11.dist-info}/METADATA +1 -1
- {clickzetta_semantic_model_generator-1.0.9.dist-info → clickzetta_semantic_model_generator-1.0.11.dist-info}/RECORD +5 -5
- semantic_model_generator/clickzetta_utils/clickzetta_connector.py +44 -22
- {clickzetta_semantic_model_generator-1.0.9.dist-info → clickzetta_semantic_model_generator-1.0.11.dist-info}/LICENSE +0 -0
- {clickzetta_semantic_model_generator-1.0.9.dist-info → clickzetta_semantic_model_generator-1.0.11.dist-info}/WHEEL +0 -0
@@ -1,5 +1,5 @@
|
|
1
1
|
semantic_model_generator/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
2
|
-
semantic_model_generator/clickzetta_utils/clickzetta_connector.py,sha256=
|
2
|
+
semantic_model_generator/clickzetta_utils/clickzetta_connector.py,sha256=LfudaByoNX8rBe1BYYhgXL7eFWC2H5tBhuivwCfn1iA,35428
|
3
3
|
semantic_model_generator/clickzetta_utils/env_vars.py,sha256=8cbL6R75c1-aVQ2i1TDr9SiHCUjTrgvXbIRz4MbcmbE,7664
|
4
4
|
semantic_model_generator/clickzetta_utils/utils.py,sha256=UBfWy9qOTyut8tL02gOHHbh6Uz8RqRz5Mm2YdKWFN54,4950
|
5
5
|
semantic_model_generator/data_processing/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -32,7 +32,7 @@ semantic_model_generator/validate/context_length.py,sha256=HL-GfaRXNcVji1-pAFGXG
|
|
32
32
|
semantic_model_generator/validate/keywords.py,sha256=frZ5HjRXP69K6dYAU5_d86oSp40_3yoLUg1eQwU3oLM,7080
|
33
33
|
semantic_model_generator/validate/schema.py,sha256=eL_wl5yscIeczwNBRUKhF_7QqWW2wSGimkgaOhMFsrA,5893
|
34
34
|
semantic_model_generator/validate_model.py,sha256=Uq-V-GfPeF2Dy4l9uF5Guv104gDCDGh0Cxz1AJOu5dk,836
|
35
|
-
clickzetta_semantic_model_generator-1.0.
|
36
|
-
clickzetta_semantic_model_generator-1.0.
|
37
|
-
clickzetta_semantic_model_generator-1.0.
|
38
|
-
clickzetta_semantic_model_generator-1.0.
|
35
|
+
clickzetta_semantic_model_generator-1.0.11.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
36
|
+
clickzetta_semantic_model_generator-1.0.11.dist-info/METADATA,sha256=redlqh04BYGLtGTzRYRL9TFjAGEpmDRdrStQrOtwT5E,7817
|
37
|
+
clickzetta_semantic_model_generator-1.0.11.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
38
|
+
clickzetta_semantic_model_generator-1.0.11.dist-info/RECORD,,
|
@@ -483,37 +483,53 @@ def _fetch_columns_via_show(
|
|
483
483
|
category = _catalog_category(session, workspace)
|
484
484
|
is_shared_catalog = category == "SHARED"
|
485
485
|
catalog = workspace if is_shared_catalog else workspace.upper()
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
if schema and not is_shared_catalog:
|
490
|
-
schema = schema.upper()
|
486
|
+
schema_token = table_schema or ""
|
487
|
+
if schema_token and not is_shared_catalog:
|
488
|
+
schema_token = schema_token.upper()
|
491
489
|
|
492
490
|
for table_name in table_names:
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
]
|
502
|
-
qualified_table = ".".join(qualified_parts)
|
503
|
-
if is_shared_catalog:
|
504
|
-
query = f"SHOW COLUMNS IN SHARE {qualified_table}"
|
505
|
-
else:
|
506
|
-
query = f"SHOW COLUMNS IN {qualified_table}"
|
491
|
+
table_token = str(table_name).strip()
|
492
|
+
if not table_token:
|
493
|
+
continue
|
494
|
+
qualified_table = join_quoted_identifiers(
|
495
|
+
*(part for part in (catalog, schema_token, table_token) if part)
|
496
|
+
)
|
497
|
+
query = f"SHOW COLUMNS IN {qualified_table}"
|
498
|
+
df_source = "SHOW COLUMNS"
|
507
499
|
try:
|
508
500
|
df = session.sql(query).to_pandas()
|
509
501
|
except Exception as exc:
|
510
502
|
logger.debug(
|
511
503
|
"SHOW COLUMNS fallback failed for {}: {}", qualified_table, exc
|
512
504
|
)
|
513
|
-
|
505
|
+
df = pd.DataFrame()
|
506
|
+
if df.empty:
|
507
|
+
describe_query = f"DESCRIBE TABLE {qualified_table}"
|
508
|
+
try:
|
509
|
+
describe_df = session.sql(describe_query).to_pandas()
|
510
|
+
except Exception as exc:
|
511
|
+
logger.debug(
|
512
|
+
"DESCRIBE TABLE fallback failed for {}: {}", qualified_table, exc
|
513
|
+
)
|
514
|
+
describe_df = pd.DataFrame()
|
515
|
+
if not describe_df.empty:
|
516
|
+
df_source = "DESCRIBE TABLE"
|
517
|
+
df = describe_df
|
514
518
|
if df.empty:
|
515
519
|
continue
|
516
520
|
df.columns = [str(col).upper() for col in df.columns]
|
521
|
+
if df_source == "DESCRIBE TABLE":
|
522
|
+
if "KIND" in df.columns:
|
523
|
+
df = df[df["KIND"].astype(str).str.upper() == "COLUMN"]
|
524
|
+
rename_map = {}
|
525
|
+
if "NAME" in df.columns:
|
526
|
+
rename_map["NAME"] = "COLUMN_NAME"
|
527
|
+
if "TYPE" in df.columns:
|
528
|
+
rename_map["TYPE"] = "DATA_TYPE"
|
529
|
+
if rename_map:
|
530
|
+
df = df.rename(columns=rename_map)
|
531
|
+
if df.empty:
|
532
|
+
continue
|
517
533
|
schema_col = next(
|
518
534
|
(col for col in ("TABLE_SCHEMA", "SCHEMA_NAME") if col in df.columns), None
|
519
535
|
)
|
@@ -536,8 +552,14 @@ def _fetch_columns_via_show(
|
|
536
552
|
)
|
537
553
|
|
538
554
|
normalized = pd.DataFrame()
|
539
|
-
normalized[_TABLE_SCHEMA_COL] =
|
540
|
-
|
555
|
+
normalized[_TABLE_SCHEMA_COL] = (
|
556
|
+
df[schema_col]
|
557
|
+
if schema_col
|
558
|
+
else (schema_token or table_schema or "")
|
559
|
+
)
|
560
|
+
normalized[_TABLE_NAME_COL] = (
|
561
|
+
df[table_col] if table_col else table_token
|
562
|
+
)
|
541
563
|
normalized[_COLUMN_NAME_COL] = (
|
542
564
|
df[column_col] if column_col else df.index.astype(str)
|
543
565
|
)
|
File without changes
|
File without changes
|