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

[dagster-tableau] Implement refreshable workbooks #24862

Merged

Conversation

maximearmstrong
Copy link
Contributor

@maximearmstrong maximearmstrong commented Sep 27, 2024

Summary & Motivation

Uses https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref_workbooks_and_views.htm#update_workbook_now to refresh workbooks built on top of extracts.

There is no API to fetch only the workbooks that can be refreshed with the Update Workbook Now endpoint, so we need to manually specify them.

How I Tested These Changes

BK with updated tests, local.

Changelog

NOCHANGELOG

Copy link
Contributor Author

maximearmstrong commented Sep 27, 2024

time.sleep(poll_interval)
job = self.get_job(job_id=job.id)

if job.finish_code == -1:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

might be nice to stick these codes in enum values or constants so it's clearer what they represent

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 1ddbbaa

dagster_tableau_translator: Type[DagsterTableauTranslator],
) -> Sequence[CacheableAssetsDefinition]:
"""Returns a set of CacheableAssetsDefinition which will load Tableau content from
the workspace and translates it into AssetSpecs, using the provided translator.

Args:
start_workbook_refresh_requests (Sequence[StartWorkbookRefreshRequest]): A list of
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's a bit unclear from the docstring what providing this argument does - this creates an SDA for each workbook associated with a request, right?

In general I think this name is a bit confusing. The user is submitting a "template" for a request and not a request itself (since the requests are made at runtime). Moreover, each request passed here instructs Dagster to build an SDA to allow the workbook to be refreshed. This is not very clearly represented in the name/docstring.

I had similar feedback for the Looker equivalent (RequestStartPdtBuild), which I guess this is modeled after. In that case the justification was that calling it RequestStartPdtBuild matched the name in documentation so it was easier for users to understand the different configuration options and to look up docs. In this case, since the only argument is the workbook ID, I don't think we get the same utility out of retaining the name from Tableau's API.

I'd suggest calling it something like enable_refreshing_workbooks and take a sequence of workbook IDs, unless we expect to add other parameters down the line. Even if we retain the dataclass name, I think the argument or docstring could be updated to be more clear, but curious for your thoughts.

Copy link
Contributor

@sryza sryza Oct 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrote this up before seeing Ben's parallel comment:


I know it's built to be parallel to a similar concept in the Looker integration, but the name StartWorkbookRefreshRequest strikes me as a little odd – it's a verb if I'm reading it correctly, but classes are normally nouns. Two thoughts:

  • Is there a shorter noun that would make more sense?
  • Do we need a class for this at all? E.g. maybe just something like refreshable_workbook_ids?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also think we should consider changing the name in Looker.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That makes a lot of sense. This is modeled after the Looker integration, but with this feedback I agree that we should make the changes in both integrations.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes made in 3c010c6

@@ -15,6 +15,11 @@ def _clean_asset_name(name: str) -> str:
return re.sub(r"[^a-z0-9A-Z.]+", "_", name).lower()


@record
class StartWorkbookRefreshRequest:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: docstring, since this is user facing

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Class removed in 3c010c6

@maximearmstrong maximearmstrong force-pushed the maxime/use-tableau-server-client-for-dagster-tableau branch from 16eeed9 to 4d5429f Compare October 2, 2024 19:12
@maximearmstrong maximearmstrong force-pushed the maxime/implement-tableau-refreshable-workbooks branch from dca7f72 to 7cefd11 Compare October 2, 2024 19:12
@maximearmstrong maximearmstrong force-pushed the maxime/use-tableau-server-client-for-dagster-tableau branch from 4d5429f to ad95ae9 Compare October 2, 2024 19:39
@maximearmstrong maximearmstrong force-pushed the maxime/implement-tableau-refreshable-workbooks branch from 7cefd11 to f764c68 Compare October 2, 2024 19:39
Base automatically changed from maxime/use-tableau-server-client-for-dagster-tableau to master October 2, 2024 19:54
@maximearmstrong maximearmstrong force-pushed the maxime/implement-tableau-refreshable-workbooks branch 2 times, most recently from a805ad2 to 3c010c6 Compare October 3, 2024 17:56
@maximearmstrong maximearmstrong changed the title [dagster-tableau] Implement StartWorkbookRefreshRequest [dagster-tableau] Implement refreshable workbooks Oct 3, 2024
@maximearmstrong maximearmstrong force-pushed the maxime/implement-tableau-refreshable-workbooks branch from 3c010c6 to 1ddbbaa Compare October 3, 2024 18:33
@maximearmstrong maximearmstrong force-pushed the maxime/implement-tableau-refreshable-workbooks branch from 8dfb00b to f0bb010 Compare October 3, 2024 19:16
Copy link
Member

@benpankow benpankow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for taking another pass 🙏

@maximearmstrong maximearmstrong merged commit db4703b into master Oct 4, 2024
2 checks passed
@maximearmstrong maximearmstrong deleted the maxime/implement-tableau-refreshable-workbooks branch October 4, 2024 01:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants