From 44d9f62bba3886d855ac73d88ef3a5014187df57 Mon Sep 17 00:00:00 2001 From: Pere Miquel Brull Date: Fri, 14 Jul 2023 14:12:11 +0200 Subject: [PATCH] Fix explore cache name (#12441) --- .../source/dashboard/looker/metadata.py | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/ingestion/src/metadata/ingestion/source/dashboard/looker/metadata.py b/ingestion/src/metadata/ingestion/source/dashboard/looker/metadata.py index a6df6e19a30..cf05a5e56e7 100644 --- a/ingestion/src/metadata/ingestion/source/dashboard/looker/metadata.py +++ b/ingestion/src/metadata/ingestion/source/dashboard/looker/metadata.py @@ -222,7 +222,6 @@ class LookerSource(DashboardServiceSource): Depending on the type of the credentials we'll need a different reader """ if not self._reader_class: - if self.service_connection.gitCredentials and isinstance( self.service_connection.gitCredentials, GitHubCredentials ): @@ -243,7 +242,6 @@ class LookerSource(DashboardServiceSource): We either get GitHubCredentials or `NoGitHubCredentials` """ if not self._repo_credentials: - if self.service_connection.gitCredentials and isinstance( self.service_connection.gitCredentials, GitHubCredentials ): @@ -405,7 +403,6 @@ class LookerSource(DashboardServiceSource): project_parser = self.parser.get(explore.project_name) if project_parser: - view: Optional[LookMlView] = project_parser.find_view( view_name=view_name, path=Includes(get_path_from_link(explore.lookml_link)), @@ -435,19 +432,22 @@ class LookerSource(DashboardServiceSource): Add the lineage source -> view -> explore """ try: + # This is the name we store in the cache + explore_name = build_datamodel_name(explore.model_name, explore.name) + explore_model = self._explores_cache.get(explore_name) + # TODO: column-level lineage parsing the explore columns with the format `view_name.col` # Now the context has the newly created view - yield AddLineageRequest( - edge=EntitiesEdge( - fromEntity=EntityReference( - id=self.context.dataModel.id.__root__, type="dashboardDataModel" - ), - toEntity=EntityReference( - id=self._explores_cache[explore.name].id.__root__, - type="dashboardDataModel", - ), + if explore_model: + yield self._get_add_lineage_request( + from_entity=self.context.dataModel, to_entity=explore_model + ) + + else: + logger.info( + f"Could not find model for explore [{explore.model_name}: {explore.name}] in the cache" + " while processing view lineage." ) - ) if view.sql_table_name: source_table_name = self._clean_table_name(view.sql_table_name)