@@ -105,24 +105,18 @@ def resolve_liquid_variable(
105
105
# Resolve liquid template
106
106
return create_template (text ).render (liquid_variable )
107
107
except LiquidSyntaxError as e :
108
- report .info (
109
- title = "Unsupported liquid template" ,
110
- message = "There are some tag specific to looker and python-liquid library does not understand them. Currently we are not parsing such liquid template." ,
111
- context = f"view-name: { view_name } , text: { text } , liquid_variable: { liquid_variable } " ,
112
- exc = e ,
113
- )
108
+ # TODO: Will add warning once we get rid of duplcate warning message for same view
109
+ logger .warning (f"Unsupported liquid template encountered. error [{ e .message } ]" )
114
110
# TODO: There are some tag specific to looker and python-liquid library does not understand them. currently
115
111
# we are not parsing such liquid template.
116
112
#
117
113
# See doc: https://cloud.google.com/looker/docs/templated-filters and look for { % condition region %}
118
114
# order.region { % endcondition %}
119
115
except CustomTagException as e :
120
- report .info (
121
- title = "Unsupported liquid template" ,
122
- message = "Rendering the Liquid template failed due to an issue with the provided variables or template syntax" ,
123
- context = f"view-name: { view_name } , text: { text } , liquid_variable: { liquid_variable } " ,
124
- exc = e ,
125
- )
116
+ # TODO: Will add warning once we get rid of duplcate warning message for same view
117
+ logger .warning (e )
118
+ logger .debug (e , exc_info = e )
119
+
126
120
return text
127
121
128
122
@@ -370,7 +364,7 @@ def __init__(
370
364
self ,
371
365
source_config : LookMLSourceConfig ,
372
366
reporter : LookMLSourceReport ,
373
- manifest_constants : List [ "LookerConstant" ],
367
+ manifest_constants : Dict [ str , "LookerConstant" ],
374
368
):
375
369
super ().__init__ (source_config = source_config , reporter = reporter )
376
370
self .manifest_constants = manifest_constants
@@ -388,17 +382,8 @@ def replace_constants(match):
388
382
return str (self .source_config .lookml_constants .get (key ))
389
383
390
384
# Resolve constant from manifest
391
- if self .manifest_constants :
392
- value = next (
393
- (
394
- constant .value
395
- for constant in self .manifest_constants
396
- if constant .name == key
397
- ),
398
- None ,
399
- )
400
- if value :
401
- return value
385
+ if key in self .manifest_constants :
386
+ return self .manifest_constants [key ].value
402
387
403
388
# Check if it's a misplaced lookml constant
404
389
if key in self .source_config .liquid_variables :
@@ -479,7 +464,7 @@ def process_lookml_template_language(
479
464
source_config : LookMLSourceConfig ,
480
465
view_lkml_file_dict : dict ,
481
466
reporter : LookMLSourceReport ,
482
- manifest_constants : List [ "LookerConstant" ] = [] ,
467
+ manifest_constants : Dict [ str , "LookerConstant" ] = {} ,
483
468
resolve_constants : bool = False ,
484
469
) -> None :
485
470
if "views" not in view_lkml_file_dict :
@@ -522,7 +507,7 @@ def load_and_preprocess_file(
522
507
path : Union [str , pathlib .Path ],
523
508
source_config : LookMLSourceConfig ,
524
509
reporter : LookMLSourceReport ,
525
- manifest_constants : List [ "LookerConstant" ] = [] ,
510
+ manifest_constants : Dict [ str , "LookerConstant" ] = {} ,
526
511
resolve_constants : bool = False ,
527
512
) -> dict :
528
513
parsed = load_lkml (path )
0 commit comments