Commit 93d9c87
fix: parse Tableau Cloud's inlined subscription <schedule> (#1627)
Tableau Server references a schedule by id inside a <subscription>:
<schedule id="cfb2..." name="Weekday mornings"/>
Tableau Cloud inlines the schedule instead -- no id attribute, but
a `frequency`, `nextRunAt` and a nested `<frequencyDetails>`:
<schedule frequency="Daily" nextRunAt="2026-08-29T16:55:00-0700">
<frequencyDetails start="16:55:00" end="16:55:00">
<intervals>
<interval hours="24"/>
<interval weekDay="Saturday"/>
</intervals>
</frequencyDetails>
</schedule>
Previously `SubscriptionItem` only pulled `id`/`name` off `<schedule>`,
so on Cloud every subscription came back with `schedule_id == None`
and no structured way to see what the API sent. Client code filtering
`[s for s in subs if s.schedule_id == target]` silently returned `[]`
on Cloud. This is the bug described in issue #1627.
Model changes:
* `SubscriptionItem` now populates a `schedule: ScheduleItem` attribute
for both shapes. On Server, `schedule.id`/`.name` are set (and
`schedule_id` remains populated for back-compat). On Cloud,
`schedule.frequency`, `schedule.next_run_at`, and
`schedule.interval_item` are set. `schedule_id` is `None` on Cloud --
the API does not send one, unavoidable. Docstring calls out the
Cloud-vs-Server discriminator and warns callers who filter by
`schedule_id`. Fixes a latent bug where the previous Cloud branch
assigned a list (return of `ScheduleItem.from_element`) to
`sub.schedule` instead of a single item.
* `ScheduleItem` gains a `frequency` property. The XML attribute was
already being read to select the interval type but was discarded;
now it's exposed so callers can distinguish the Cloud shape without
reaching into the interval object. The class `Attributes` docstring
is rewritten to cover every public property and to note that only
`frequency` / `next_run_at` / `interval_item` are populated when the
item comes from an inlined Cloud subscription schedule.
* `_parse_interval_item` is defensive against malformed Cloud data:
a `<frequencyDetails>` without a `start` attribute no longer crashes
on `strptime(None, ...)`, and an out-of-range `<interval hours="3"/>`
(or unknown weekDay / monthDay) no longer raises `ValueError` out of
`IntervalItem` and poisons sibling schedules in the same page. Bad
data degrades to `interval_item = None` with a warning log.
Datetime plumbing:
* `parse_datetime` learns the Tableau Cloud `%Y-%m-%dT%H:%M:%S%z` form
(e.g. `2026-08-29T16:55:00-0700`) in addition to the Server `...Z`
form. Unparseable input still returns `None` on the read path
(preserving the pre-change contract that a malformed server-side
date cannot crash a page-through of unrelated data).
* `property_is_datetime` now raises `ValueError` when `parse_datetime`
returns `None` for a non-empty str value. Bad *user* input is
surfaced at the assignment site instead of silently nulling the
attribute.
* `TABLEAU_CLOUD_DATE_FORMAT` is public, matching the existing
`TABLEAU_DATE_FORMAT`.
Tests:
* New `test/assets/subscription_get_cloud.xml` mirroring the shape
observed on `stage-dp1` (API 3.29) and matching parse tests for
both Cloud and Server shapes.
* Three edge-case Cloud fixtures + tests: no `<frequencyDetails>`,
empty `<intervals/>`, out-of-set `<interval hours="3"/>`.
* Existing subscription tests extended to cover sub 2 and
`get_subscription_by_id`.
* New `test/test_datetime_helpers.py` with direct coverage of
`parse_datetime` (None / "" / garbage / Server / Cloud / colon-offset
/ microseconds) and `property_is_datetime` (valid / bad / non-str).
* `test/test_schedule.py::test_get` asserts the new
`ScheduleItem.frequency` property on the standard /schedules endpoint.
Refs: #1627
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 6820191 commit 93d9c87
11 files changed
Lines changed: 600 additions & 57 deletions
File tree
- tableauserverclient
- models
- test
- assets
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
29 | 33 | | |
30 | 34 | | |
31 | 35 | | |
32 | | - | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
33 | 45 | | |
34 | 46 | | |
35 | | - | |
36 | 47 | | |
37 | 48 | | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
38 | 53 | | |
39 | 54 | | |
40 | 55 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
126 | 126 | | |
127 | 127 | | |
128 | 128 | | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
129 | 134 | | |
130 | 135 | | |
131 | 136 | | |
| |||
138 | 143 | | |
139 | 144 | | |
140 | 145 | | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
141 | 151 | | |
142 | 152 | | |
143 | 153 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| |||
65 | 66 | | |
66 | 67 | | |
67 | 68 | | |
68 | | - | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
69 | 77 | | |
70 | 78 | | |
71 | | - | |
| 79 | + | |
72 | 80 | | |
73 | 81 | | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
78 | 105 | | |
79 | 106 | | |
80 | | - | |
81 | | - | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
82 | 121 | | |
83 | 122 | | |
84 | 123 | | |
| |||
100 | 139 | | |
101 | 140 | | |
102 | 141 | | |
| 142 | + | |
103 | 143 | | |
104 | 144 | | |
105 | 145 | | |
| |||
133 | 173 | | |
134 | 174 | | |
135 | 175 | | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
136 | 185 | | |
137 | 186 | | |
138 | 187 | | |
| |||
194 | 243 | | |
195 | 244 | | |
196 | 245 | | |
| 246 | + | |
197 | 247 | | |
198 | 248 | | |
199 | 249 | | |
| |||
231 | 281 | | |
232 | 282 | | |
233 | 283 | | |
| 284 | + | |
234 | 285 | | |
235 | 286 | | |
236 | 287 | | |
| |||
256 | 307 | | |
257 | 308 | | |
258 | 309 | | |
| 310 | + | |
| 311 | + | |
259 | 312 | | |
260 | 313 | | |
261 | 314 | | |
| |||
276 | 329 | | |
277 | 330 | | |
278 | 331 | | |
| 332 | + | |
279 | 333 | | |
280 | 334 | | |
281 | 335 | | |
| |||
298 | 352 | | |
299 | 353 | | |
300 | 354 | | |
| 355 | + | |
301 | 356 | | |
302 | 357 | | |
303 | 358 | | |
304 | 359 | | |
305 | 360 | | |
306 | 361 | | |
307 | 362 | | |
| 363 | + | |
| 364 | + | |
308 | 365 | | |
309 | | - | |
| 366 | + | |
| 367 | + | |
310 | 368 | | |
311 | 369 | | |
312 | 370 | | |
| |||
315 | 373 | | |
316 | 374 | | |
317 | 375 | | |
318 | | - | |
319 | | - | |
320 | | - | |
321 | | - | |
322 | | - | |
323 | | - | |
324 | | - | |
325 | | - | |
326 | | - | |
327 | | - | |
328 | | - | |
329 | | - | |
330 | | - | |
331 | | - | |
332 | | - | |
333 | | - | |
334 | | - | |
335 | | - | |
336 | | - | |
337 | | - | |
338 | | - | |
339 | | - | |
340 | | - | |
341 | | - | |
342 | | - | |
343 | | - | |
344 | | - | |
345 | | - | |
346 | | - | |
347 | | - | |
348 | | - | |
349 | | - | |
350 | | - | |
351 | | - | |
352 | | - | |
353 | | - | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
354 | 431 | | |
355 | | - | |
| 432 | + | |
356 | 433 | | |
357 | 434 | | |
358 | 435 | | |
| |||
383 | 460 | | |
384 | 461 | | |
385 | 462 | | |
| 463 | + | |
386 | 464 | | |
387 | 465 | | |
388 | 466 | | |
| |||
0 commit comments