From f1daf12f21ba547d03b80d7ddd2cc279e2ce984d Mon Sep 17 00:00:00 2001 From: sagar-salvi-apptware Date: Sat, 18 Jan 2025 20:26:26 +0530 Subject: [PATCH] fix: rename liquid_variable -> liquid_variables --- metadata-ingestion/docs/sources/looker/looker_recipe.yml | 2 +- metadata-ingestion/docs/sources/looker/lookml_post.md | 4 ++-- .../ingestion/source/looker/looker_template_language.py | 4 ++-- .../src/datahub/ingestion/source/looker/lookml_config.py | 6 +++++- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/metadata-ingestion/docs/sources/looker/looker_recipe.yml b/metadata-ingestion/docs/sources/looker/looker_recipe.yml index 388824df200522..7b4b53448fa23c 100644 --- a/metadata-ingestion/docs/sources/looker/looker_recipe.yml +++ b/metadata-ingestion/docs/sources/looker/looker_recipe.yml @@ -9,7 +9,7 @@ source: client_secret: ${LOOKER_CLIENT_SECRET} # Liquid variables - # liquid_variable: + # liquid_variables: # _user_attributes: # looker_env: "dev" # dev_database_prefix: "employee" diff --git a/metadata-ingestion/docs/sources/looker/lookml_post.md b/metadata-ingestion/docs/sources/looker/lookml_post.md index d3b963a0604610..ee7070de220ab1 100644 --- a/metadata-ingestion/docs/sources/looker/lookml_post.md +++ b/metadata-ingestion/docs/sources/looker/lookml_post.md @@ -1,9 +1,9 @@ #### Configuration Notes -1. If a view contains a liquid template (e.g. `sql_table_name: {{ user_attributes['db']}}.kafka_streaming.events }}`, with `db=ANALYTICS_PROD`), then you will need to specify the values of those variables in the `liquid_variable` config as shown below: +1. If a view contains a liquid template (e.g. `sql_table_name: {{ user_attributes['db']}}.kafka_streaming.events }}`, with `db=ANALYTICS_PROD`), then you will need to specify the values of those variables in the `liquid_variables` config as shown below: ```yml - liquid_variable: + liquid_variables: user_attributes: db: ANALYTICS_PROD ``` diff --git a/metadata-ingestion/src/datahub/ingestion/source/looker/looker_template_language.py b/metadata-ingestion/src/datahub/ingestion/source/looker/looker_template_language.py index 99ed2bd0aef180..478a6ca687b295 100644 --- a/metadata-ingestion/src/datahub/ingestion/source/looker/looker_template_language.py +++ b/metadata-ingestion/src/datahub/ingestion/source/looker/looker_template_language.py @@ -269,7 +269,7 @@ class LiquidVariableTransformer(LookMLViewTransformer): def _apply_transformation(self, value: str, view: dict) -> str: return resolve_liquid_variable( text=value, - liquid_variable=self.source_config.liquid_variable, + liquid_variable=self.source_config.liquid_variables, report=self.reporter, ) @@ -385,7 +385,7 @@ def replace_constants(match): return str(self.source_config.lookml_constants.get(key)) # Check if it's a misplaced lookml constant - if key in self.source_config.liquid_variable: + if key in self.source_config.liquid_variables: self.reporter.report_warning( title="Misplaced lookml constant", message="Misplaced lookml constant, Use 'lookml_constants' instead of 'liquid_variables'.", diff --git a/metadata-ingestion/src/datahub/ingestion/source/looker/lookml_config.py b/metadata-ingestion/src/datahub/ingestion/source/looker/lookml_config.py index ad438fdad88599..543f280910eb19 100644 --- a/metadata-ingestion/src/datahub/ingestion/source/looker/lookml_config.py +++ b/metadata-ingestion/src/datahub/ingestion/source/looker/lookml_config.py @@ -158,13 +158,17 @@ class LookMLSourceConfig( description="When enabled, looker refinement will be processed to adapt an existing view.", ) - liquid_variable: Dict[Any, Any] = Field( + liquid_variables: Dict[Any, Any] = Field( {}, description="A dictionary containing Liquid variables, Liquid logic, and LookML parameters with their corresponding values, utilized in SQL-defined " "derived views. The Liquid template will be resolved in view.derived_table.sql and " "view.sql_table_name. Defaults to an empty dictionary.", ) + _liquid_variable_deprecated = pydantic_renamed_field( + old_name="liquid_variable", new_name="liquid_variables", print_warning=True + ) + lookml_constants: Dict[str, str] = Field( {}, description=(