-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
940de24
commit 29d5d4d
Showing
3 changed files
with
46 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
from semantic_model_generator.protos.semantic_model_pb2 import Table | ||
|
||
def validate_contains_datatype_for_each_col(table: Table) -> None: | ||
# Ensure every col for every table has 'data_type' present. | ||
for dim_col in table.dimensions: | ||
if dim_col.data_type is None or len(dim_col.data_type) < 2: # account for spaces | ||
raise ValueError(f"Your Semantic Model contains a col {dim_col.name} that does not have the `data_type` field. Please add.") | ||
for measure_col in table.measures: | ||
if measure_col.data_type is None or len(measure_col.data_type) < 2: # account for spaces | ||
raise ValueError(f"Your Semantic Model contains a col {measure_col.name} that does not have the `data_type` field. Please add.") | ||
for time_dim_col in table.time_dimensions: | ||
if time_dim_col.data_type is None or len(time_dim_col.data_type) < 2: # account for spaces | ||
raise ValueError(f"Your Semantic Model contains a col {time_dim_col.name} that does not have the `data_type` field. Please add.") |