Hi, I'm encountering an issue when trying to execute an action in Dataform for a specific table that exists in multiple datasets. I have a table table_name in both dataset_0 and dataset_1, and I would like to execute the action only on dataset_0.table_name. However, when I run the following command:
Dataform encountered an error: Ambiguous Action name: table_name. Did you mean one of: project.dataset_1.table_name, project.dataset_0.table_name.
Error: Ambiguous Action name: table_name. Did you mean one of: project.dataset_1.table_name, project.dataset_0.table_name.
at /opt/homebrew/lib/node_modules/@dataform/cli/bundle.js:27630:23
at Array.forEach (<anonymous>)
at matchPatterns (/opt/homebrew/lib/node_modules/@dataform/cli/bundle.js:27618:14)
at computeIncludedActionNames (/opt/homebrew/lib/node_modules/@dataform/cli/bundle.js:27699:9)
at prune (/opt/homebrew/lib/node_modules/@dataform/cli/bundle.js:27684:33)
at build (/opt/homebrew/lib/node_modules/@dataform/cli/bundle.js:28082:25)
at Object.processFn (/opt/homebrew/lib/node_modules/@dataform/cli/bundle.js:30673:50)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Object.handler (/opt/homebrew/lib/node_modules/@dataform/cli/bundle.js:29593:30)
I've tried various ways to qualify the table name with the dataset and folder structure:
None of these attempts have successfully executed the action, and I haven't found anything useful in the documentation regarding how to address this issue.
How can I specify the correct dataset and table in the command to avoid the ambiguity?
Solved! Go to Solution.
Try this:
dataform run --actions YOUR_GOOGLE_CLOUD_PROJECT_ID.dataset_0.table_name
What does your sqlx look like?
// File definitions/dataset_0/table_name
config {
type: "operations",
schema: "dataset_0",
hasOutput: true,
tags: []
}
CREATE TABLE IF NOT EXISTS ${self()}
(
col1 STRING,
col2 TIMESTAMP
)
PARTITION BY DATE(col2);
GRANT `roles/bigquery.dataEditor`
ON
TABLE ${self()}
TO "serviceAccount:${dataform.projectConfig.vars.serviceAccount}";
// File definitions/dataset_1/table_name
config {
type: "view",
schema: "dataset_1",
tags: [],
)
}
SELECT
col1,
col2,
FROM
${ref("dataset_0", "table_name")}
QUALIFY
MAX(col2) OVER () = col2
Try this:
dataform run --actions YOUR_GOOGLE_CLOUD_PROJECT_ID.dataset_0.table_name
Thank you very much. That works!