Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ingestion/lookml): support looker -- if comments #11113

Merged
merged 13 commits into from
Aug 16, 2024
1 change: 1 addition & 0 deletions metadata-ingestion/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@
*sqlglot_lib,
"GitPython>2",
"python-liquid",
"deepmerge>=1.1.1"
}

bigquery_common = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1,10 @@
IMPORTED_PROJECTS = "imported_projects"
SQL_TABLE_NAME = "sql_table_name"
DATAHUB_TRANSFORMED_SQL_TABLE_NAME = "datahub_transformed_sql_table_name"
DERIVED_TABLE = "derived_table"
SQL = "sql"
DATAHUB_TRANSFORMED_SQL = "datahub_transformed_sql"
prod = "prod"
dev = "dev"
NAME = "name"
DERIVED_DOT_SQL = "derived.sql"
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
import logging
import pathlib
from dataclasses import replace
from typing import Any, Dict, Optional
from typing import Dict, Optional

from datahub.ingestion.source.looker.lkml_patched import load_lkml
from datahub.ingestion.source.looker.looker_config import LookerConnectionDefinition
from datahub.ingestion.source.looker.looker_dataclasses import LookerViewFile
from datahub.ingestion.source.looker.looker_template_language import (
resolve_liquid_variable_in_view_dict,
process_lookml_template_language,
)
from datahub.ingestion.source.looker.lookml_config import (
_EXPLORE_FILE_EXTENSION,
_VIEW_FILE_EXTENSION,
LookMLSourceConfig,
LookMLSourceReport,
)

Expand All @@ -29,13 +30,13 @@ def __init__(
root_project_name: Optional[str],
base_projects_folder: Dict[str, pathlib.Path],
reporter: LookMLSourceReport,
liquid_variable: Dict[Any, Any],
source_config: LookMLSourceConfig,
) -> None:
self.viewfile_cache: Dict[str, Optional[LookerViewFile]] = {}
self._root_project_name = root_project_name
self._base_projects_folder = base_projects_folder
self.reporter = reporter
self.liquid_variable = liquid_variable
self.source_config = source_config

def _load_viewfile(
self, project_name: str, path: str, reporter: LookMLSourceReport
Expand Down Expand Up @@ -73,9 +74,9 @@ def _load_viewfile(

parsed = load_lkml(path)

resolve_liquid_variable_in_view_dict(
raw_view=parsed,
liquid_variable=self.liquid_variable,
process_lookml_template_language(
view_lkml_file_dict=parsed,
source_config=self.source_config,
)

looker_viewfile = LookerViewFile.from_looker_dict(
Expand Down
Loading
Loading