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

Using disabed config in dataform

Hi team, 

Problem: I've got some really big tables that I don't want my models to be building daily, only during specific days of the month (which changes as my organisation's fiscal month doesn't match calendar month). I have the calendar in one of my tables, but it isn't something that can be codified.

In the PROD environment, the scheduled model builds are tag based, and is currently triggered by Google Workflows. 
In the DEV environment, the scheduled model builds is a blanket build statement across the whole environment, triggered by Dataform workflow configurations. 

Is there a way to skip building certain models depending on certain conditions? 

I've played around with using "disabled" in the config block, what I've done is created a boolean variable based off the results of a query, and I tried passing that into "disabled" but I don't think that works as you can't pass any variables into that field.

Anyone got any suggestions? 

P.S. we're using Dataform Console

0 1 233
1 REPLY 1

Hi @Dave-K ,

Welcome to Google Cloud Community!

Below are the possible solutions to run certain models based on your organization's fiscal month in Dataform:

  • You can use a conditional expression to check if today's date falls within your fiscal period. If it does, the model will only run for those dates that match your fiscal timeline.
  • You may also try to define a SQL statement to be executed before table creation using pre_operation block in Dataform. The pre_operations block is where you'll implement the conditional logic using SQL to determine if the model should run based on your fiscal calendar.

I hope the above information is helpful.