mirror of
https://github.com/datahub-project/datahub.git
synced 2025-12-25 08:58:26 +00:00
feat(ingest/dremio): Retrieve default_schema for SQL views (#11832)
This commit is contained in:
parent
c42f779859
commit
74a84885df
@ -774,3 +774,14 @@ class DremioAPIOperations:
|
||||
containers.extend(future.result())
|
||||
|
||||
return containers
|
||||
|
||||
def get_context_for_vds(self, resource_id: str) -> str:
|
||||
context_array = self.get(
|
||||
url=f"/catalog/{resource_id}",
|
||||
).get("sqlContext")
|
||||
if context_array:
|
||||
return ".".join(
|
||||
f'"{part}"' if "." in part else f"{part}" for part in context_array
|
||||
)
|
||||
else:
|
||||
return ""
|
||||
|
||||
@ -200,6 +200,7 @@ class DremioDataset:
|
||||
columns: List[DremioDatasetColumn]
|
||||
sql_definition: Optional[str]
|
||||
dataset_type: DremioDatasetType
|
||||
default_schema: Optional[str]
|
||||
owner: Optional[str]
|
||||
owner_type: Optional[str]
|
||||
created: str
|
||||
@ -235,6 +236,9 @@ class DremioDataset:
|
||||
|
||||
if self.sql_definition:
|
||||
self.dataset_type = DremioDatasetType.VIEW
|
||||
self.default_schema = api_operations.get_context_for_vds(
|
||||
resource_id=self.resource_id
|
||||
)
|
||||
else:
|
||||
self.dataset_type = DremioDatasetType.TABLE
|
||||
|
||||
|
||||
@ -417,6 +417,7 @@ class DremioSource(StatefulIngestionSourceBase):
|
||||
view_urn=dataset_urn,
|
||||
view_definition=dataset_info.sql_definition,
|
||||
default_db=self.default_db,
|
||||
default_schema=dataset_info.default_schema,
|
||||
)
|
||||
|
||||
elif dataset_info.dataset_type == DremioDatasetType.TABLE:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user