Fix explore cache name (#12441)

This commit is contained in:
Pere Miquel Brull 2023-07-14 14:12:11 +02:00 committed by GitHub
parent d8e64b4f30
commit 44d9f62bba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -222,7 +222,6 @@ class LookerSource(DashboardServiceSource):
Depending on the type of the credentials we'll need a different reader Depending on the type of the credentials we'll need a different reader
""" """
if not self._reader_class: if not self._reader_class:
if self.service_connection.gitCredentials and isinstance( if self.service_connection.gitCredentials and isinstance(
self.service_connection.gitCredentials, GitHubCredentials self.service_connection.gitCredentials, GitHubCredentials
): ):
@ -243,7 +242,6 @@ class LookerSource(DashboardServiceSource):
We either get GitHubCredentials or `NoGitHubCredentials` We either get GitHubCredentials or `NoGitHubCredentials`
""" """
if not self._repo_credentials: if not self._repo_credentials:
if self.service_connection.gitCredentials and isinstance( if self.service_connection.gitCredentials and isinstance(
self.service_connection.gitCredentials, GitHubCredentials self.service_connection.gitCredentials, GitHubCredentials
): ):
@ -405,7 +403,6 @@ class LookerSource(DashboardServiceSource):
project_parser = self.parser.get(explore.project_name) project_parser = self.parser.get(explore.project_name)
if project_parser: if project_parser:
view: Optional[LookMlView] = project_parser.find_view( view: Optional[LookMlView] = project_parser.find_view(
view_name=view_name, view_name=view_name,
path=Includes(get_path_from_link(explore.lookml_link)), path=Includes(get_path_from_link(explore.lookml_link)),
@ -435,19 +432,22 @@ class LookerSource(DashboardServiceSource):
Add the lineage source -> view -> explore Add the lineage source -> view -> explore
""" """
try: 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` # TODO: column-level lineage parsing the explore columns with the format `view_name.col`
# Now the context has the newly created view # Now the context has the newly created view
yield AddLineageRequest( if explore_model:
edge=EntitiesEdge( yield self._get_add_lineage_request(
fromEntity=EntityReference( from_entity=self.context.dataModel, to_entity=explore_model
id=self.context.dataModel.id.__root__, type="dashboardDataModel" )
),
toEntity=EntityReference( else:
id=self._explores_cache[explore.name].id.__root__, logger.info(
type="dashboardDataModel", f"Could not find model for explore [{explore.model_name}: {explore.name}] in the cache"
), " while processing view lineage."
) )
)
if view.sql_table_name: if view.sql_table_name:
source_table_name = self._clean_table_name(view.sql_table_name) source_table_name = self._clean_table_name(view.sql_table_name)