Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Dataform - dynamic name of the dataset

Hello everyone,

I need help with Dataform. I have been using JS file for storing variables, one of them is dataset name that I want to look something like this "something_20241022" basically string plus current date. I've created it successfully and added the variable in create_dataset.sqlx file. Dataset is created properly with a proper name.

My issue is with using the dynamic dataset name in other .sqlx files. So I have multiple views, tables and models that should be created in that newly created dataset, which name I won't know until I run the job and dataset is created. Currently that's an issue that I cannot find a solution for nor there's any documentation about this.

I've already tried to use type: "operations" instead of "view" but than an issue is that the action is not creating any result and all of the dependents raise an error that they can't call action that doesn't provide the result.

Please if you have some suggestions let me know.

Solved Solved
0 2 771
1 ACCEPTED SOLUTION

Hi,

Did you try the config like this ?

config {
  type: "operations",
  hasOutput: true  // optional, lets you reference the empty table
}

CREATE TABLE ${self()} (

)

With the option hasOutput, the operations give result and can be used for later references

View solution in original post

2 REPLIES 2

Hi,

Did you try the config like this ?

config {
  type: "operations",
  hasOutput: true  // optional, lets you reference the empty table
}

CREATE TABLE ${self()} (

)

With the option hasOutput, the operations give result and can be used for later references

Hey,

Great! This actually made it work, thank you a lot.