Skip to content

Commit 3bf5c78

Browse files
authored
feat(looker): only fetch a subset of fields from the Looker API (#24624)
## Summary & Motivation Reduce the time for API requests + the size of the cacheable asset by only fetching the fields from the Looker API used in the `dagster-looker` implementation. ## How I Tested These Changes local ## Changelog NOCHANGELOG
1 parent d4c1eed commit 3bf5c78

File tree

1 file changed

+34
-3
lines changed
  • python_modules/libraries/dagster-looker/dagster_looker/api

1 file changed

+34
-3
lines changed

python_modules/libraries/dagster-looker/dagster_looker/api/resource.py

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,17 +61,40 @@ def fetch_looker_instance_data(self) -> LookerInstanceData:
6161
sdk = self.get_sdk()
6262

6363
# Get dashboards
64-
dashboards = sdk.all_dashboards()
64+
dashboards = sdk.all_dashboards(
65+
fields=",".join(
66+
[
67+
"id",
68+
"hidden",
69+
]
70+
)
71+
)
6572
dashboards_by_id = {
66-
dashboard.id: sdk.dashboard(dashboard_id=dashboard.id)
73+
dashboard.id: sdk.dashboard(
74+
dashboard_id=dashboard.id,
75+
fields=",".join(
76+
[
77+
"id",
78+
"title",
79+
"dashboard_filters",
80+
]
81+
),
82+
)
6783
for dashboard in dashboards
6884
if dashboard.id and not dashboard.hidden
6985
}
7086

7187
# Get explore names from models
7288
explores_for_model = {
7389
model.name: [explore.name for explore in (model.explores or []) if explore.name]
74-
for model in sdk.all_lookml_models()
90+
for model in sdk.all_lookml_models(
91+
fields=",".join(
92+
[
93+
"name",
94+
"explores",
95+
]
96+
)
97+
)
7598
if model.name
7699
}
77100

@@ -82,6 +105,14 @@ def fetch_looker_instance_data(self) -> LookerInstanceData:
82105
lookml_explore = sdk.lookml_model_explore(
83106
lookml_model_name=model_name,
84107
explore_name=explore_name,
108+
fields=",".join(
109+
[
110+
"id",
111+
"view_name",
112+
"sql_table_name",
113+
"joins",
114+
]
115+
),
85116
)
86117

87118
explores_by_id[check.not_none(lookml_explore.id)] = lookml_explore

0 commit comments

Comments
 (0)