Skip to content

@W-24630680: Wire and package embedded Excel/CSV datasources for data apps - #21

Open
patrickg2014 wants to merge 21 commits into
mainfrom
pgreen/package-data-resources
Open

patrickg2014 wants to merge 21 commits into
mainfrom
pgreen/package-data-resources

Conversation

@patrickg2014

@patrickg2014 patrickg2014 commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Problem

A data app can embed an Excel or CSV file in its .twbx instead of querying a published datasource, but the skill couldn't build one: wire_datasource.py only wired published datasources, and package_twbx.py dropped Data/ and Resources/.agents/.

Change

  • wire_datasource.py: new "type": "file" descriptor wires an embedded .xls/.xlsx/.xlsm (one sheet) or .csv under Data/. Can be mixed with published datasources.
  • package_twbx.py: packs Data/ and Resources/.agents/ at the archive root. Under Data/, only files the .twb references; everything else, symlinks, and hidden files are skipped and listed on stderr. Fails if a referenced file is missing.
  • apply_plan.py: rejects a template containing symlinks.
  • SKILL.md and references: the embedded-file steps, and how Tableau names CSV columns.

Pairs with tableau/tableau-mcp#1118 (adds the two folders to the template).

Testing

  • Unit tests: 88 pass.
  • End to end on a test site: embedded Excel (two sheets), CSV mixed with a published datasource, 14 CSV format variants, and the extensions-api Superstore sample. Each was published and queried with query-datasource and in the browser.

package_twbx.py wrote only the .twb and Packages/ into the .twbx, so a data
app whose .twb references an embedded datasource file (for example
Data/Datasources/Sample - Superstore.xls) packaged and published cleanly but
had no data at runtime.

Also pack Data/ and Resources/ at the archive root when the workspace has
them. The .twb is still written first, OS cruft is still skipped, the
Packages/ and .trex checks are unchanged, and nothing else at the workspace
root is packed. SKILL.md's Package section says so.
Comment thread src/plugin/skills/tableau-data-app-authoring/scripts/package_twbx.py Outdated
Comment thread src/plugin/skills/tableau-data-app-authoring/scripts/package_twbx.py Outdated
Address review feedback on package_twbx.py:

- Pack only Resources/.agents/ (the agent-docs folder that travels with
  the workbook) instead of all of Resources/.
- Skip any file or dir whose name starts with "." below the packed dirs,
  and list each one on stderr with the reason. SKILL.md says to relay
  those lines to the user.
- Fail when the .twb references a Data/ file (connection filename or
  dbname) that is missing from the workspace.
- Follow symlinked dirs, with a guard against symlink loops.
@patrickg2014 patrickg2014 changed the title Pack Data/ and Resources/ in package_twbx.py Pack Data/ and Resources/.agents/ in package_twbx.py Oct 22, 2026
@patrickg2014 patrickg2014 changed the title Pack Data/ and Resources/.agents/ in package_twbx.py @W-24630680: Pack Data/ and Resources/.agents/ in package_twbx.py Oct 22, 2026
CSV, JSON, and shapefile connections split the path across two attributes
(directory='Data' filename='x.csv'), so the missing-file check only saw
'x.csv' and let a workbook with no embedded data package cleanly. Join
directory and filename before checking. Excel and Hyper keep the whole
path in one attribute and are unchanged.
…ckaging

The scaffold-data-app template now ships Data/.gitkeep and
Resources/.agents/README.md, so the plugin no longer owns that layout.

- package_twbx.py: pack a dir only when it holds a packed file, so the
  template's Data/ (only .gitkeep) stays out of the .twbx; skip .gitkeep
  silently.
- wire_datasource.py: add "type": "file" descriptors for Excel
  (excel-direct) and CSV (textscan) files under Data/, wired as federated
  datasources alongside published ones in a single run.
- SKILL.md: describe the template's Data/ and Resources/.agents/, the
  embedded file wiring steps, and the packaging rules.
- package_twbx.py: cut only symlink cycles, so an alias no longer hides the
  real path; check .twb references against the packed names (catches case
  mismatches macOS hides); fail cleanly on dangling or unreadable files;
  write to a temp file so a failure never truncates an existing .twbx; never
  pack the output into itself.
- wire_datasource.py: double ] in field names; reject connectionName hashes
  that aren't letters and digits.
- References: cover embedded Excel/CSV files (snapshot, local introspection).
A followed link could pull any file on the machine (an SSH key, a PAT file)
into a .twbx that gets published. package_twbx.py now skips and reports every
symlink below the packed dirs (and a linked Data/ or Resources/.agents/),
and fails if the .twb or Packages/ is one; a .twb reference to a skipped link
fails as missing. wire_datasource.py rejects a symlinked data file up front.
Packaging now packs only the Data/ files the .twb references and reports any
other file there as skipped. A symlink pointing at the output is reported like
any other link. apply_plan.py refuses a template containing symlinks, since
safe_join only checks path text. Removes em dashes added on this branch.
@patrickg2014 patrickg2014 changed the title @W-24630680: Pack Data/ and Resources/.agents/ in package_twbx.py @W-24630680: Wire and package embedded Excel/CSV datasources for data apps Oct 23, 2026
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.

2 participants