Expose refreshExtractTriggered on SubscriptionItem - #1861
Open
jacalata wants to merge 1 commit into
Open
Conversation
The Tableau REST API supports a `refreshExtractTriggered="true"` attribute on subscription payloads that makes the subscription fire when its referenced schedule's extract refresh completes, rather than on the schedule's time trigger. On Tableau Cloud, this is the wire form of an "On Extract Refresh" subscription. TSC never exposed this attribute; users trying to create these subscriptions were passing `schedule_id=None` and hitting a confusing wire error deep in the endpoint layer. Changes: - `SubscriptionItem.on_extract_refresh(...)` classmethod factory constructs a subscription with an extract-refresh schedule id and the flag set. - `refresh_extract_triggered` exposed as a property with a docstring covering the two ways the server surprises callers (server rejects True with a non-extract schedule; server silently clears the flag when a schedule change is included in an update). - `Subscriptions.create()` and `.update()` now raise `ValueError` up front when `schedule_id` is missing, so the wire error becomes an actionable client-side message. - `create_req` emits `refreshExtractTriggered="true"` only when set; `update_req` emits both true and false so callers can turn the flag off on an existing subscription. - `_parse_element` reads the attribute back into the property; parse continues to accept inline-schedule responses (schedule_id=None). Tests cover: factory sets flag + schedule id; default false; create_req emit-when-set/omit-when-false; update_req always emits; parse round-trip for both true and missing; parse of inline-schedule responses; create() and update() reject missing schedule_id. Related to #1658. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds support for the REST API's
refreshExtractTriggered="true"attribute on subscriptions -- the wire form of Tableau Cloud's "On Extract Refresh" subscriptions. When True, the subscription fires when the referenced schedule's extract refresh completes, rather than on the schedule's time trigger.Closes #1658.
What changes
SubscriptionItem.on_extract_refresh(subject, extract_refresh_schedule_id, user_id, target)classmethod factory -- the recommended way to construct these subscriptions.refresh_extract_triggeredis now a boolean property onSubscriptionItem. Its docstring covers the two ways the server can surprise callers:schedule_idcause the server to silently clear the flag to False on that same call; converting an existing time-based subscription requires two updates.Subscriptions.create()and.update()now raiseValueErrorup front ifschedule_idis missing, so what used to be a confusing wire-layer error becomes an actionable client-side message.create_reqemitsrefreshExtractTriggered="true"only when set.update_reqemits both"true"and"false"unconditionally, so callers can turn the flag off on an existing subscription (the server retains the prior value when the attribute is absent)._parse_elementreads the attribute back into the property.Compatibility note
Every
subscriptions.update()payload now carriesrefreshExtractTriggered="true|false". Older servers that don't know the attribute should ignore unknown attrs on the<subscription>element per the schema's<xs:anyAttribute processContents="skip"/>; the attribute has been on the server since long before TSC's current minimum version.Test plan
pytest test/test_subscription.py -q-- 16 pass, including 12 new tests covering the factory, defaults,create_reqemit-when-set / omit-when-false,update_reqalways-emits in both directions, parse round-trip with and without the attribute, parse of inline-schedule responses (noschedule_id), andcreate()/update()rejection of missing schedule_id.on_extract_refresh(), confirm it appears as "On Extract Refresh" in the web UI, and confirm it fires when the referenced extract refresh runs.🤖 Generated with Claude Code