Skip to content

Commit f6d2c84

Browse files
committed
add debugging options for detecting missing column types
1 parent 8c1feda commit f6d2c84

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

dbt2looker/cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def run():
7878
argparser.add_argument(
7979
'--log-level',
8080
help='Set level of logs. Default is INFO',
81-
choices=['DEBUG', 'INFO', 'WARNING', 'ERROR'],
81+
choices=[logging.DEBUG, logging.INFO, logging.WARN, logging.ERROR],
8282
type=lambda x: getattr(logging, x),
8383
default=logging.INFO,
8484
)

dbt2looker/parser.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import logging
2-
from typing import Dict, Optional
2+
from typing import Dict, Optional, List
33

44
from . import models
55

@@ -42,11 +42,19 @@ def parse_models(raw_manifest: dict, tag=None):
4242
return filtered_models
4343

4444

45+
def check_models_for_missing_column_types(dbt_typed_models: List[models.DbtModel]):
46+
for model in dbt_typed_models:
47+
if all([col.data_type is None for col in model.columns.values()]):
48+
logging.debug('Model %s has no typed columns, no dimensions will be generated. %s', model.unique_id, model)
49+
50+
4551
def parse_typed_models(raw_manifest: dict, raw_catalog: dict, tag: Optional[str] = None):
4652
catalog_nodes = parse_catalog_nodes(raw_catalog)
4753
dbt_models = parse_models(raw_manifest, tag=tag)
4854
adapter_type = parse_adapter_type(raw_manifest)
4955

56+
logging.debug('Parsed %d models from manifest.json', len(dbt_models))
57+
5058
# Check catalog for models
5159
for model in dbt_models:
5260
if model.unique_id not in catalog_nodes:
@@ -65,6 +73,9 @@ def parse_typed_models(raw_manifest: dict, raw_catalog: dict, tag: Optional[str]
6573
for model in dbt_models
6674
if model.unique_id in catalog_nodes
6775
]
76+
logging.debug('Found catalog entries for %d models', len(dbt_typed_models))
77+
logging.debug('Catalog entries missing for %d models', len(dbt_models) - len(dbt_typed_models))
78+
check_models_for_missing_column_types(dbt_typed_models)
6879
return dbt_typed_models
6980

7081

0 commit comments

Comments
 (0)