/tableau-to-sigma:tableau-vds-to-cdwfrom Tableau → Sigma
Extracts data from published Tableau datasources via VizQL Data Service API and lands it in Snowflake or Databricks for Sigma consumption. Supports one-shot or scheduled refresh without manual CSV export.
Ships in Tableau → Sigma. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
Extract data from a published Tableau datasource via the VizQL Data Service (VDS) API and land it in a cloud data warehouse so Sigma can build on it. The Tableau/VDS extraction half is warehouse-agnostic — only the landing step changes per target.
Supported targets:
| Target | Landing mechanism | Section |
|---|---|---|
| Snowflake | Stored procedure + External Access Integration, scheduled with a Task | Part A |
| Databricks | Notebook on serverless compute + secret scope, scheduled with a Workflow | Part B |
| BigQuery | Not built yet — the extraction half ports directly; landing = a Cloud Function / scheduled query. File an issue if needed. | — |
Both Snowflake and Databricks paths are validated end-to-end with parity verified in Sigma against the landed table (Superstore: 10,192 rows, exact on Technology/Office Supplies, expected null-key row-level drift on the total — see Column types).
VDS only works against published Tableau datasources. If the workbook you care about uses an embedded extract (the common case for Tableau community samples and one-off "extract from CSV, dashboard on top" workbooks), VDS will not see it.
mcp__tableau__list-datasourcesandsearch-contentwithcontentTypes=["datasource"]only return published datasources — if the source you want isn't there, it's embedded.To VDS an embedded extract, the workbook owner must first publish the datasource separately in Tableau Cloud (right-click datasource → Publish Data Source). That's a one-time UI step per datasource. After publishing, the datasource shows up via the MCP and VDS can read it.
Always check this before running the skill — surface the gap to the user rather than burning turns on a query that can't succeed.
Tableau Published Datasource
│
│ POST /api/v1/vizql-data-service/query-datasource
│ (auth via PAT + x-tableau-auth header)
▼
Server-side compute in the warehouse
(Snowflake stored proc | Databricks notebook)
- signs in to Tableau REST API
- calls VDS query endpoint
- creates/replaces target table
- loads rows
│
▼
Warehouse table ──▶ Sigma Workbook
The extraction + load runs server-side (Snowflake proc / Databricks job), so no data touches Claude or the local machine — the warehouse fetches directly from Tableau. The local CLI only orchestrates (deploys the proc/notebook, kicks off the run, polls status).
mcp__tableau__list-datasources
Returns a list with id (the LUID) and name. Use the id value.
If the datasource you expect isn't in the list, it's almost certainly embedded in a workbook rather than published. See the callout above.
bash -c '
AUTH=$(curl -s -X POST "https://{server}/api/3.21/auth/signin" \
-H "Content-Type: application/json" \
-d "{\"credentials\": {
\"personalAccessTokenName\": \"{pat_name}\",
\"personalAccessTokenSecret\": \"{pat_secret}\",
\"site\": {\"contentUrl\": \"{site_name}\"}}}")
TOKEN=$(echo "$AUTH" | python3 -c "import sys,re; print(re.search(r\"token=\\\"([^\\\"]+)\\\"\", sys.stdin.read()).group(1))")
SITE_ID=$(echo "$AUTH" | python3 -c "import sys,re; print(re.search(r\"site id=\\\"([^\\\"]+)\\\"\", sys.stdin.read()).group(1))")
curl -s -H "x-tableau-auth: $TOKEN" \
"https://{server}/api/3.21/sites/$SITE_ID/datasources?pageSize=100" \
| python3 -c "import sys,re; [print(m[0], m[1]) for m in re.findall(r\"datasource id=\\\"([^\\\"]+)\\\" name=\\\"([^\\\"]+)\\\"\", sys.stdin.read())]"
'
Auth response is XML, not JSON. Parse with
re.search(r'token="([^"]+)"', ...). Do NOT pipe tojq— it will fail silently or error.
# Quick test — should return {"data": [...]}
bash -c '
AUTH=$(curl -s -X POST "https://{server}/api/3.21/auth/signin" \
-H "Content-Type: application/json" \
-d "{\"credentials\": {\"personalAccessTokenName\": \"{pat_name}\", \"personalAccessTokenSecret\": \"{pat_secret}\", \"site\": {\"contentUrl\": \"{site_name}\"}}}")
TOKEN=$(echo "$AUTH" | python3 -c "import sys,re; print(re.search(r\"token=\\\"([^\\\"]+)\\\"\", sys.stdin.read()).group(1))")
curl -s -X POST "https://{server}/api/v1/vizql-data-service/query-datasource" \
-H "x-tableau-auth: $TOKEN" \
-H "Content-Type: application/json" \
-d "{\"datasource\": {\"datasourceLuid\": \"{luid}\"}, \"query\": {\"fields\": [{\"fieldCaption\": \"{any_field}\"}]}, \"options\": {\"returnFormat\": \"OBJECTS\"}}" \
| python3 -m json.tool
'
Use the MCP metadata tool:
mcp__tableau__get-datasource-metadata datasourceLuid="<luid>"
The response includes all CALCULATION fields with their Tableau formulas —
that's the right input for translating calc fields into the downstream Sigma
DM. See ../tableau-to-sigma/scripts/extract-calc-fields.rb for a pre-built
extractor + translation-notes generator.
Or query the VDS metadata endpoint directly:
curl -s -X POST "https://<server>/api/v1/vizql-data-service/read-metadata" \
-H "x-tableau-auth: $TOKEN" \
-H "Content-Type: application/json" \
-d '{"datasource": {"datasourceLuid": "<luid>"}}' | python3 -m json.tool
fields array (used by both targets)Each field is one of:
{"fieldCaption": "Category"} — dimension (no aggregation){"fieldCaption": "Sales", "function": "SUM", "fieldAlias": "Total Sales"} — measureSupported function values: SUM, AVG, MEDIAN, COUNT, COUNTD, MIN, MAX.
To land row-level facts (most common for downstream Sigma DM authoring), omit
functionfrom every field. Withfunction, VDS aggregates server-side and returns a much smaller result set — fine for a pre-rolled-up extract, usually not what you want for a flexible Sigma workbook.
contentUrl — all from Phase 1.TJ.PUBLIC)CREATE NETWORK RULE, CREATE SECRET, CREATE INTEGRATION, CREATE PROCEDURE, CREATE TABLE privileges
SNOWFLAKE_SANDBOX_TSE_PUSH_GROUPSIGMA_WH)snow) configured with key-pair JWT auth:
~/.snowflake/config.tomlsnow sql -q "SELECT CURRENT_USER()" --connection <conn>Skip this phase if the setup already exists. Network rule + secret + EAI
- procedure are created once per Snowflake account/schema and reused for every subsequent VDS load. Check first:
snow sql --connection <conn> -q "
SHOW EXTERNAL ACCESS INTEGRATIONS LIKE 'tableau%';
SHOW SECRETS LIKE 'tableau%' IN SCHEMA <db>.<schema>;
SHOW NETWORK RULES LIKE 'tableau%' IN SCHEMA <db>.<schema>;
"
snow sql --connection <conn> --format json -q \
"SHOW PROCEDURES LIKE 'QUERY_TABLEAU%' IN SCHEMA <db>.<schema>" \
| python3 -c "import sys,json; print('procs:', [p['name'] for p in json.load(sys.stdin)])"
If all four exist (and you trust the PAT secret is current), jump to Phase A3.
The rest of this phase covers first-time setup. Replace TJ.PUBLIC throughout.
Write to /tmp/vds_setup.sql:
USE ROLE <your_role>;
USE DATABASE <db>;
USE SCHEMA <schema>;
CREATE OR REPLACE NETWORK RULE tableau_api_rule
MODE = EGRESS
TYPE = HOST_PORT
VALUE_LIST = ('<tableau_server_host>'); -- e.g. 'us-west-2b.online.tableau.com'
CREATE OR REPLACE SECRET tableau_pat_secret
TYPE = GENERIC_STRING
SECRET_STRING = '{"pat_name": "<pat_name>", "pat_secret": "<pat_secret>"}';
CREATE OR REPLACE EXTERNAL ACCESS INTEGRATION tableau_vds_eai
ALLOWED_NETWORK_RULES = (<db>.<schema>.tableau_api_rule)
ALLOWED_AUTHENTICATION_SECRETS = (<db>.<schema>.tableau_pat_secret)
ENABLED = TRUE;
snow sql --connection <conn> -f /tmp/vds_setup.sql
Write to /tmp/vds_proc.sql:
USE ROLE <your_role>;
USE DATABASE <db>;
USE SCHEMA <schema>;
CREATE OR REPLACE PROCEDURE query_tableau_vds(
server_url STRING,
site_name STRING,
datasource_luid STRING,
target_table STRING,
fields_json STRING
)
RETURNS STRING
LANGUAGE PYTHON
RUNTIME_VERSION = '3.11'
PACKAGES = ('snowflake-snowpark-python', 'requests')
EXTERNAL_ACCESS_INTEGRATIONS = (tableau_vds_eai)
SECRETS = ('pat_creds' = <db>.<schema>.tableau_pat_secret)
HANDLER = 'run'
AS $$
import _snowflake
import requests
import json
import re
# --- vds-landing shared column-plan (keep in sync with scripts/vds_landing_lib.py) ---
def sanitize_caption(caption):
# Legacy UPPER_SNAKE sanitizer — byte-identical to the historical one.
return re.sub(r'[^A-Z0-9_]', '_', caption.upper())
def captions_from_fields(fields):
# Result captions in fields_json request order (= ordinal order). VDS keys
# OBJECTS rows by fieldAlias else fieldCaption; duplicate result captions
# collapse into one dict key (positionally unrecoverable) — refuse.
caps = [f.get('fieldAlias') or f['fieldCaption'] for f in fields]
seen = set()
for c in caps:
if c in seen:
raise ValueError('duplicate result caption %r in fields — '
'positional recovery impossible; fix the request' % c)
seen.add(c)
return caps
def build_column_plan(captions):
# plan[i] = {'ordinal': i, 'caption': captions[i], 'column': landed name}.
# First occurrence of a sanitized base keeps it; later collisions get _2,
# _3, ... in encounter order; a suffixed candidate that itself collides
# keeps counting. Pure function of the caption sequence — deterministic.
plan, taken, counts = [], set(), {}
for i, cap in enumerate(captions):
base = sanitize_caption(cap)
n = counts.get(base, 1)
col = base if n == 1 else '%s_%d' % (base, n)
while col in taken:
n += 1
col = '%s_%d' % (base, n)
counts[base] = n
taken.add(col)
plan.append({'ordinal': i, 'caption': cap, 'column': col})
return plan
def resolve_projection(plan, ordinals):
# Landed columns for one logical table, by field ordinal ONLY (positions
# in the landing's fields_json order). Suffixes ride along. No caption
# matching, no re-sanitization, no name heuristics.
cols = []
for o in ordinals:
if not isinstance(o, int) or isinstance(o, bool):
raise TypeError('ordinal %r is not an int — resolve by position, '
'never by name' % (o,))
if o < 0 or o >= len(plan):
raise ValueError('ordinal %d out of range for %d landed columns'
% (o, len(plan)))
cols.append(plan[o]['column'])
return cols
# --- end vds-landing shared column-plan ---
def run(session, server_url, site_name, datasource_luid, target_table, fields_json):
creds = json.loads(_snowflake.get_generic_secret_string('pat_creds'))
# Sign in — Tableau returns XML
signin = requests.post(
f'{server_url}/api/3.21/auth/signin',
headers={'Content-Type': 'application/json'},
json={'credentials': {
'personalAccessTokenName': creds['pat_name'],
'personalAccessTokenSecret': creds['pat_secret'],
'site': {'contentUrl': site_name}
}},
timeout=30
)
signin.raise_for_status()
token = re.search(r'token="([^"]+)"', signin.text).group(1)
# Ordinal order = fields_json request order. Derive result captions from
# the REQUEST (not rows[0].keys()) so provenance is positional and stable.
fields = json.loads(fields_json)
captions = captions_from_fields(fields)
# Query VDS
resp = requests.post(
f'{server_url}/api/v1/vizql-data-service/query-datasource',
headers={'x-tableau-auth': token, 'Content-Type': 'application/json'},
json={
'datasource': {'datasourceLuid': datasource_luid},
'query': {'fields': fields},
'options': {'returnFormat': 'OBJECTS'}
},
timeout=60
)
resp.raise_for_status()
rows = resp.json()['data']
if not rows:
return 'No rows returned'
# UPPER_SNAKE_CASE + deterministic collision suffixes (_2, _3 ...)
plan = build_column_plan(captions)
safe_cols = [e['column'] for e in plan]
col_defs = ', '.join(f'{c} VARIANT' for c in safe_cols)
session.sql(f'CREATE OR REPLACE TABLE {target_table} ({col_defs})').collect()
from snowflake.snowpark import Row
sf_rows = [Row(**dict(zip(safe_cols, [row.get(c) for c in captions]))) for row in rows]
df = session.create_dataframe(sf_rows)
df.write.mode('overwrite').save_as_table(target_table)
# Ordinal->column provenance manifest — the ONLY sanctioned input for
# downstream per-logical-table splits (see refs/collision-provenance.md)
cm = [Row(ORDINAL=e['ordinal'], FIELD_CAPTION=e['caption'], COLUMN_NAME=e['column'])
for e in plan]
session.create_dataframe(cm).write.mode('overwrite') \
.save_as_table(f'{target_table}__VDS_COLMAP')
suffixed = sum(1 for e in plan if e['column'] != sanitize_caption(e['caption']))
return (f'Loaded {len(rows)} rows into {target_table} '
f'({len(safe_cols)} cols, {suffixed} collision-suffixed); '
f'colmap -> {target_table}__VDS_COLMAP')
$$;
snow sql --connection <conn> -f /tmp/vds_proc.sql
Build the fields_json array per the shared "Building the fields array" section.
Use mcp__tableau__get-datasource-metadata to list available field captions.
snow sql --connection <conn> -q "
USE ROLE <your_role>;
USE DATABASE <db>;
USE SCHEMA <schema>;
USE WAREHOUSE <wh>;
CALL query_tableau_vds(
'https://<server>',
'<site_name>',
'<datasource_luid>',
'<db>.<schema>.<TABLE_NAME>',
'[
{\"fieldCaption\": \"Category\"},
{\"fieldCaption\": \"Sales\", \"function\": \"SUM\", \"fieldAlias\": \"Total Sales\"}
]'
);
"
snow sql --connection <conn> --format json -q "
SELECT COUNT(*) AS n FROM <db>.<schema>.<TABLE_NAME>;
SELECT * FROM <db>.<schema>.<TABLE_NAME> LIMIT 3;
" | python3 -m json.tool
CREATE OR REPLACE TASK refresh_tableau_data
WAREHOUSE = <wh>
SCHEDULE = 'USING CRON 0 6 * * * America/Los_Angeles' -- daily at 6am PT
AS
CALL query_tableau_vds(
'https://<server>',
'<site_name>',
'<datasource_luid>',
'<db>.<schema>.<TABLE_NAME>',
'[{"fieldCaption": "Category"}, {"fieldCaption": "Sales", "function": "SUM", "fieldAlias": "Total Sales"}]'
);
-- Tasks start suspended; resume to activate
ALTER TASK refresh_tableau_data RESUME;
Check task history:
SELECT name, state, scheduled_time, completed_time, error_message
FROM TABLE(INFORMATION_SCHEMA.TASK_HISTORY(task_name => 'refresh_tableau_data'))
ORDER BY scheduled_time DESC LIMIT 10;
snow sql --connection tj -q "
USE ROLE SNOWFLAKE_SANDBOX_TSE_PUSH_GROUP;
USE DATABASE TJ;
USE SCHEMA PUBLIC;
USE WAREHOUSE SIGMA_WH;
CALL QUERY_TABLEAU_VDS(
'https://us-west-2b.online.tableau.com',
'mysite',
'0f0e0d0c-0b0a-4900-8807-060504030201',
'DEMO_DB.PUBLIC.SUPERSTORE_ORDERS',
'[
{\"fieldCaption\": \"Order ID\"}, {\"fieldCaption\": \"Order Date\"},
{\"fieldCaption\": \"Ship Date\"}, {\"fieldCaption\": \"Customer Name\"},
{\"fieldCaption\": \"Segment\"}, {\"fieldCaption\": \"Country/Region\"},
{\"fieldCaption\": \"State/Province\"}, {\"fieldCaption\": \"Category\"},
{\"fieldCaption\": \"Sub-Category\"}, {\"fieldCaption\": \"Sales\"},
{\"fieldCaption\": \"Profit\"}, {\"fieldCaption\": \"Quantity\"},
{\"fieldCaption\": \"Discount\"}
]'
);
"
# → Loaded 10192 rows into DEMO_DB.PUBLIC.SUPERSTORE_ORDERS
19 columns landed (Country/Region → COUNTRY_REGION, Sub-Category → SUB_CATEGORY
from the slash/hyphen → _ sanitizer). KPI parity with the Tableau Executive Overview
was within 0.02% on Sales/Profit/Quantity — exact on Profit Ratio and Discount.
The Databricks path is simpler than Snowflake — the entire EAI + network-rule egress phase disappears, because cluster/serverless compute has outbound internet by default. The mapping:
| Snowflake | Databricks |
|---|---|
| Stored proc (Snowpark) | A notebook on serverless compute |
| EAI + network rule + secret | Just a secret scope — no network plumbing |
df.write.save_as_table | df.write.saveAsTable → Delta table in Unity Catalog |
| Snowflake Task | Databricks Workflow schedule |
https://dbc-xxxx.cloud.databricks.com) and a
workspace PAT (User Settings → Developer → Access tokens).brew install databricks/tap/databricks
Configure a profile (host + token) — either ~/.databrickscfg:
[myprofile]
host = https://dbc-xxxx.cloud.databricks.com
token = dapi...
or via env: export DATABRICKS_HOST=... DATABRICKS_TOKEN=.... Verify:
databricks current-user me -p myprofile
zsh gotcha: do NOT pass the profile via an unquoted shell var (
P="-p myprofile"; databricks ... $P). zsh does not word-split unquoted expansions, so the CLI receives one arg" myprofile"and errorshas no myprofile profile configured. Use the literal flag-p myprofileorexport DATABRICKS_CONFIG_PROFILE=myprofile.
catalog.schema.table. Confirm your
principal has CREATE SCHEMA / CREATE TABLE before running (see Phase B0).Unity Catalog privilege ≠ workspace admin. Being a workspace/account admin does NOT grant UC table-create rights. A run that extracts fine from Tableau will still fail at
CREATE SCHEMAwithPERMISSION_DENIEDif your principal lacks the grant. Check the target catalog's grants up front:
databricks grants get catalog <catalog> -p myprofile -o json \
| python3 -c "import sys,json; [print(a['principal'], a['privileges']) for a in json.load(sys.stdin).get('privilege_assignments',[])]"
Look for ALL_PRIVILEGES or CREATE_SCHEMA+CREATE_TABLE on one of your groups.
Pick a catalog where you have it (or ask the workspace owner to grant it).
databricks secrets create-scope <scope> -p myprofile # e.g. tableau_vds
databricks secrets put-secret <scope> tableau_pat_name --string-value "<pat_name>" -p myprofile
databricks secrets put-secret <scope> tableau_pat_secret --string-value "<pat_secret>" -p myprofile
databricks secrets list-secrets <scope> -p myprofile # confirm both keys
Write to /tmp/vds_to_delta.py (Databricks SOURCE notebook — the # Databricks notebook source first line and # COMMAND ---------- cell separators matter):
# Databricks notebook source
import requests, re, json
from datetime import datetime, timezone
# --- vds-landing shared column-plan (keep in sync with scripts/vds_landing_lib.py) ---
def sanitize_caption(caption):
# Legacy UPPER_SNAKE sanitizer — byte-identical to the historical one.
return re.sub(r'[^A-Z0-9_]', '_', caption.upper())
def captions_from_fields(fields):
# Result captions in fields_json request order (= ordinal order). VDS keys
# OBJECTS rows by fieldAlias else fieldCaption; duplicate result captions
# collapse into one dict key (positionally unrecoverable) — refuse.
caps = [f.get('fieldAlias') or f['fieldCaption'] for f in fields]
seen = set()
for c in caps:
if c in seen:
raise ValueError('duplicate result caption %r in fields — '
'positional recovery impossible; fix the request' % c)
seen.add(c)
return caps
def build_column_plan(captions):
# plan[i] = {'ordinal': i, 'caption': captions[i], 'column': landed name}.
# First occurrence of a sanitized base keeps it; later collisions get _2,
# _3, ... in encounter order; a suffixed candidate that itself collides
# keeps counting. Pure function of the caption sequence — deterministic.
plan, taken, counts = [], set(), {}
for i, cap in enumerate(captions):
base = sanitize_caption(cap)
n = counts.get(base, 1)
col = base if n == 1 else '%s_%d' % (base, n)
while col in taken:
n += 1
col = '%s_%d' % (base, n)
counts[base] = n
taken.add(col)
plan.append({'ordinal': i, 'caption': cap, 'column': col})
return plan
def resolve_projection(plan, ordinals):
# Landed columns for one logical table, by field ordinal ONLY (positions
# in the landing's fields_json order). Suffixes ride along. No caption
# matching, no re-sanitization, no name heuristics.
cols = []
for o in ordinals:
if not isinstance(o, int) or isinstance(o, bool):
raise TypeError('ordinal %r is not an int — resolve by position, '
'never by name' % (o,))
if o < 0 or o >= len(plan):
raise ValueError('ordinal %d out of range for %d landed columns'
% (o, len(plan)))
cols.append(plan[o]['column'])
return cols
# --- end vds-landing shared column-plan ---
# COMMAND ----------
server = dbutils.widgets.get("server") # https://us-west-2b.online.tableau.com
site = dbutils.widgets.get("site") # contentUrl, e.g. mysite
luid = dbutils.widgets.get("luid") # datasource LUID
target = dbutils.widgets.get("target") # catalog.schema.table
fields_json = dbutils.widgets.get("fields") # VDS fields array (JSON string)
pat_name = dbutils.secrets.get("<scope>", "tableau_pat_name")
pat_secret = dbutils.secrets.get("<scope>", "tableau_pat_secret")
# Sign in — Tableau returns XML; parse with regex (NOT jq/json)
signin = requests.post(
f"{server}/api/3.21/auth/signin",
headers={"Content-Type": "application/json"},
json={"credentials": {
"personalAccessTokenName": pat_name,
"personalAccessTokenSecret": pat_secret,
"site": {"contentUrl": site},
}},
timeout=30,
)
signin.raise_for_status()
tok = re.search(r'token="([^"]+)"', signin.text).group(1)
# Ordinal order = fields_json request order (mirror the Snowflake proc)
fields = json.loads(fields_json)
captions = captions_from_fields(fields)
# Query VDS
resp = requests.post(
f"{server}/api/v1/vizql-data-service/query-datasource",
headers={"x-tableau-auth": tok, "Content-Type": "application/json"},
json={
"datasource": {"datasourceLuid": luid},
"query": {"fields": fields},
"options": {"returnFormat": "OBJECTS"},
},
timeout=300,
)
resp.raise_for_status()
rows = resp.json()["data"]
if not rows:
dbutils.notebook.exit("No rows returned")
# UPPER_SNAKE_CASE + deterministic collision suffixes (mirror the Snowflake proc)
plan = build_column_plan(captions)
safe_cols = [e["column"] for e in plan]
data = [tuple(r.get(c) for c in captions) for r in rows]
df = spark.createDataFrame(data, schema=safe_cols)
cat, sch, tbl = target.split(".")
spark.sql(f"CREATE SCHEMA IF NOT EXISTS `{cat}`.`{sch}`")
df.write.mode("overwrite").saveAsTable(target)
# Ordinal->column provenance manifest — the ONLY sanctioned input for
# downstream per-logical-table splits (see refs/collision-provenance.md)
colmap = spark.createDataFrame(
[(e["ordinal"], e["caption"], e["column"]) for e in plan],
schema="ordinal INT, field_caption STRING, column_name STRING")
colmap.write.mode("overwrite").saveAsTable(f"{target}__vds_colmap")
n = spark.table(target).count()
suffixed = sum(1 for e in plan if e["column"] != sanitize_caption(e["caption"]))
dbutils.notebook.exit(json.dumps({"rows": n, "target": target,
"collision_suffixed": suffixed,
"colmap": f"{target}__vds_colmap",
"loaded_at": datetime.now(timezone.utc).isoformat()}))
Import it into the workspace:
databricks workspace import "/Users/<you>@<org>/vds_to_delta" \
--file /tmp/vds_to_delta.py --language PYTHON --format SOURCE --overwrite -p myprofile
Why serverless: SQL warehouses can't run the Python
requestscall, and workspaces often have no all-purpose cluster. A Job notebook task with no cluster spec runs on serverless automatically (in workspaces with serverless enabled) — no cluster to create or pay to keep warm.
Write the run request to /tmp/vds_run.json (the fields value is a JSON string):
{
"run_name": "vds_to_delta",
"tasks": [{
"task_key": "vds_to_delta",
"notebook_task": {
"notebook_path": "/Users/<you>@<org>/vds_to_delta",
"base_parameters": {
"server": "https://<server>",
"site": "<site_name>",
"luid": "<datasource_luid>",
"target": "<catalog>.<schema>.<TABLE_NAME>",
"fields": "[{\"fieldCaption\": \"Category\"}, {\"fieldCaption\": \"Sales\"}]"
}
}
}]
}
Submit and poll:
RID=$(databricks jobs submit --json @/tmp/vds_run.json --no-wait -p myprofile \
| python3 -c "import sys,json; print(json.load(sys.stdin)['run_id'])")
# poll until life_cycle_state == TERMINATED
databricks jobs get-run $RID -p myprofile -o json \
| python3 -c "import sys,json; s=json.load(sys.stdin)['state']; print(s.get('life_cycle_state'), s.get('result_state'))"
# read the notebook exit value (row count) / error
TR=$(databricks jobs get-run $RID -p myprofile -o json | python3 -c "import sys,json; print(json.load(sys.stdin)['tasks'][0]['run_id'])")
databricks jobs get-run-output $TR -p myprofile -o json \
| python3 -c "import sys,json; d=json.load(sys.stdin); print('EXIT:', d.get('notebook_output',{}).get('result')); print('ERR:', d.get('error'))"
databricks tables get <catalog>.<schema>.<TABLE_NAME> -p myprofile -o json \
| python3 -c "import sys,json; d=json.load(sys.stdin); print(d['data_source_format'], d['table_type']); [print(' ',c['name'],c['type_text']) for c in d['columns']]"
Persist a Job with a schedule (instead of one-shot submit):
databricks jobs create --json '{
"name": "refresh_tableau_data",
"schedule": {"quartz_cron_expression": "0 0 6 * * ?", "timezone_id": "America/Los_Angeles"},
"tasks": [{"task_key": "vds_to_delta",
"notebook_task": {"notebook_path": "/Users/<you>@<org>/vds_to_delta",
"base_parameters": { "...": "same as B3" }}}]
}' -p myprofile
Superstore (a published datasource on a Tableau Cloud site) → serverless notebook →
customer_success.tj_vds_spike.superstore_orders (managed Delta): 10,192 rows,
13 columns, same sanitization as Snowflake (Country/Region→COUNTRY_REGION,
Sub-Category→SUB_CATEGORY). Sigma read it back via a Databricks connection on the
same workspace — Technology/Office Supplies SUM(Sales) exact, total within 0.02%
(null-key row-level drift, see below).
Both targets infer types from the data:
| Tableau field type | Snowflake | Databricks |
|---|---|---|
REAL / INTEGER measures | FLOAT / NUMBER(38,0) | double / bigint |
STRING dimensions | VARCHAR | string |
DATE / DATETIME | VARCHAR (ISO string) | string (ISO string) |
Dates land as strings on both — VDS returns ISO strings like 2022-11-07T00:00:00.
Sigma introspects and auto-types them as datetime. Downstream Sigma DM column
formulas should use Date([SOURCE/Col Name]) directly:
{ "id": "so-order-date", "name": "Order Date",
"formula": "Date([SUPERSTORE_ORDERS/Order Date])" }
Do NOT use the
Date(Left(Text([col]), 10))pattern here. That works for integer YYYYMMDD date keys (see../tableau-to-sigma/refs/column-gotchas.md) but fails on the VARCHAR/string ISO datetimes VDS produces, because Sigma auto-types them asdatetimeat the DM column level andLeft()doesn't compile against datetime.
Row-level drift (both targets): when landing row-level facts (no
function), expect the table's row count and re-aggregated measures to differ slightly from a server-side aggregated VDS query — VDS drops rows with NULL key fields (~0.02%; measured Superstore 10,192 landed vs ~10,194 canonical). This is expected, not a bug.
Optional: create a typed view to lock down explicit casts (Snowflake shown; Databricks
is the same with CREATE OR REPLACE VIEW <cat>.<sch>.<tbl>_TYPED AS ...):
CREATE OR REPLACE VIEW <db>.<schema>.<TABLE_NAME>_TYPED AS
SELECT
CATEGORY::VARCHAR AS CATEGORY,
ORDER_DATE::DATE AS ORDER_DATE,
TOTAL_SALES::FLOAT AS TOTAL_SALES
FROM <db>.<schema>.<TABLE_NAME>;
Distinct captions can sanitize to the same name (Full Date, Full-Date,
Full.Date → FULL_DATE). The landing assigns deterministic collision
suffixes — first occurrence keeps the base, later ones get _2, _3 in
fields_json order — and lands a provenance manifest next to every table:
<target>__VDS_COLMAP (Snowflake) / <target>__vds_colmap (Databricks) with
(ordinal, field_caption, column_name), where ordinal = the field's position
in the request. Anything downstream that projects a subset of the landed
columns (typed views, per-logical-table splits) MUST resolve columns through
the manifest by ordinal — never by re-sanitizing captions, which is blind
to the suffixes and silently grabs another field's column. Contract, worked
split example, and the offline test suite: refs/collision-provenance.md,
scripts/vds_landing_lib.py, scripts/test_vds_landing_lib.py.
After a CREATE OR REPLACE TABLE / saveAsTable (which is what the load does every
run), Sigma's cached catalog metadata for that table may be stale until Sigma
re-syncs:
POST /v2/connections/{connectionId}/sync with body
{"path": ["<DB>", "<SCHEMA>", "<TABLE>"]} — one call per landed table.source.kind: sql)
rather than the catalog table — raw SQL executes directly and bypasses the stale
catalog index. (This is exactly how the parity check reads a just-landed table.)| Error / symptom | Cause | Fix |
|---|---|---|
Expected datasource not in list-datasources | Embedded in a workbook, not published | Publish the datasource separately in Tableau Cloud — VDS only sees published datasources |
404 on /api/v1/sites/.../datasources/.../query | Wrong VDS URL | Use /api/v1/vizql-data-service/query-datasource with datasource.datasourceLuid in body |
401 on VDS query | PAT token expired (~hours) or wrong header name | Re-authenticate; confirm header is x-tableau-auth not Authorization |
json.decoder.JSONDecodeError on auth | Tableau signin returns XML, not JSON | Parse with re.search(r'token="([^"]+)"', resp.text) |
VDS returns {"error": "datasource not found"} | LUID wrong or datasource moved/deleted | Re-fetch LUID via list-datasources |
| Row count ~0.02% below Tableau total | VDS drops rows with NULL key fields | Expected drift; investigate only if exact parity required |
Columns with spaces/slashes/hyphens get _ substitution | sanitize_caption UPPER_SNAKE sanitizer | Expected — use a typed view or rename in the Sigma DM |
A column landed as <NAME>_2 / <NAME>_3 | Two+ captions sanitize to the same name; collision suffixes assigned in fields_json order | Expected — read <target>__VDS_COLMAP for caption→column; resolve downstream projections by ordinal, never by re-sanitizing captions |
ValueError: duplicate result caption ... before the VDS call | Two fields resolve to the same result caption (alias == another caption) | Fix the request: give one field a distinct fieldAlias — identical result captions can't be recovered positionally |
| Split/typed views mix columns from the wrong logical table | Downstream resolver re-sanitized captions instead of consuming the colmap | Rebuild projections from <target>__VDS_COLMAP ordinals — see refs/collision-provenance.md |
Sigma DM column type error for a date | Date landed as VARCHAR/string; Sigma auto-types datetime; Left()/Text() won't compile | Use Date([SOURCE/Col Name]) directly |
| Error / symptom | Cause | Fix |
|---|---|---|
| EAI creation: "Network rule not found" | FQN required | Use <db>.<schema>.tableau_api_rule in ALLOWED_NETWORK_RULES |
| Procedure: "secret not found" | Secret must be fully qualified | Use <db>.<schema>.tableau_pat_secret in SECRETS = (...) |
requests.exceptions.ConnectionError in proc | EAI not attached, or host mismatch | Confirm EXTERNAL_ACCESS_INTEGRATIONS = (tableau_vds_eai) in the DDL; host in network rule matches exactly |
| Setup re-runs every conversion | Phase A2 treated as per-conversion | A2 is one-time per account + schema; check existing infra first |
| Task runs but table empty | PAT expired (max TTL) | Rotate PAT → ALTER SECRET tableau_pat_secret SET SECRET_STRING = '...' |
| Error / symptom | Cause | Fix |
|---|---|---|
PERMISSION_DENIED: no CREATE SCHEMA on <catalog> | UC privilege ≠ workspace admin | Run Phase B0 grant check; pick a catalog where your group has CREATE_SCHEMA/ALL_PRIVILEGES, or ask the owner |
has no <profile> profile configured (double space) | zsh didn't word-split an unquoted $VAR holding -p <profile> | Use literal -p <profile> or export DATABRICKS_CONFIG_PROFILE=<profile> |
| Job needs a cluster / no all-purpose cluster exists | Notebook task given no compute and serverless disabled | Enable serverless for notebooks/jobs, or add a job_clusters spec; SQL warehouses can't run the requests call |
INTERNAL_ERROR with no detail in get-run | Real error is in the task run output | get-run-output <task_run_id> → read error / error_trace |
| Sigma can't see the just-landed table | Connection catalog metadata cache lag | Verify via raw Custom SQL (source.kind: sql), or refresh the connection in the Sigma UI |
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
tableau, vizql-data-service, data-extraction, snowflake, databricks, sigma
npx claudepluginhub sigmacomputing/sigma-migration-skills --plugin tableau-to-sigma3 skills in this plugin
/tableau-assessmentTake inventory of a Tableau Cloud site and produce a migration-readiness readout — environment counts, licenses, datasource mix, refresh history, per-workbook usage, per-workbook complexity (via .twb gap-scan), and a value/cost-ranked migration shortlist. Use when a user wants to scope a Tableau→Sigma migration, audit BI sprawl, or pick which workbooks to convert first. Lightweight (~90s) MCP-driven pre-scoping; complements Hakkoda's deeper Assessment App rather than replacing it./tableau-to-sigmaConvert a Tableau datasource or workbook into a Sigma data model and matching dashboard. Use when the user has a Tableau datasource, TDS file, or Tableau workbook and wants to recreate it in Sigma. Discovery, calc-field translation, data model + workbook creation via REST API, layout generation, and parity verification — driven by the selected Ruby or Python runtime profile.Other plugins' skills for the same job