Skip to content

Commit f108c42

Browse files
committed
add debugging statements for measures
1 parent fc62bd5 commit f108c42

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

dbt2looker/generator.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,12 @@ def lookml_view_from_dbt_model(model: models.DbtModel, adapter_type: models.Supp
283283
'measures': lookml_measures_from_model(model),
284284
}
285285
}
286+
logging.debug(
287+
f'Created view from model %s with %d measures, %d dimensions',
288+
model.name,
289+
len(lookml['view']['measures']),
290+
len(lookml['view']['dimensions']),
291+
)
286292
contents = lkml.dump(lookml)
287293
filename = f'{model.name}.view'
288294
return models.LookViewFile(filename=filename, contents=contents)
@@ -310,4 +316,4 @@ def lookml_model_from_dbt_model(model: models.DbtModel, dbt_project_name: str):
310316
}
311317
contents = lkml.dump(lookml)
312318
filename = f'{model.name}.model'
313-
return models.LookModelFile(filename=filename, contents=contents)
319+
return models.LookModelFile(filename=filename, contents=contents)

dbt2looker/parser.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import jsonschema
44
import importlib.resources
55
from typing import Dict, Optional, List
6+
from functools import reduce
67

78
from . import models
89

@@ -73,6 +74,13 @@ def parse_typed_models(raw_manifest: dict, raw_catalog: dict, tag: Optional[str]
7374
adapter_type = parse_adapter_type(raw_manifest)
7475

7576
logging.debug('Parsed %d models from manifest.json', len(dbt_models))
77+
for model in dbt_models:
78+
logging.debug(
79+
'Model %s has %d columns with %d measures',
80+
model.name,
81+
len(model.columns),
82+
reduce(lambda acc, col: acc + len(col.meta.measures), model.columns.values(), 0)
83+
)
7684

7785
# Check catalog for models
7886
for model in dbt_models:

0 commit comments

Comments
 (0)