override defaultLocation in dataform.json

Hi Team,

Is there any way to override "defaultLocation" value in dataform.json through dataform UI release/workflow configuration.

Thank you,

Amit

1 1 418
1 REPLY 1

According to the Google Cloud Dataform documentation, , the defaultLocation cannot be directly overridden through the Dataform UI or workflow configuration. However, you can use the Dataform API to create a compilation result with custom compilation overrides, which can include a different Google Cloud project ID.

Here's how you can do it:

  1. Create a compilationResults.create request. In this request, you need to specify a source for the compilation result. This could be a Dataform workspace or a Git branch, Git tag, or Git commit SHA.

  2. In the CodeCompilationConfig object of the compilationResults.create request, you can configure compilation overrides. For example, to override the defaultLocation, you can set the defaultDatabase property to the desired Google Cloud project ID.

Here's an example of how to override the defaultLocation:

{
"codeCompilationConfig": {
"defaultDatabase": "your-desired-project-id"
}
}

  1. xecute the compilationResults.create request. This will create a compilation result with the specified overrides.

  2. To execute the created compilation result, pass the compilation result ID returned by the compilationResults.create request in a workflowInvocations.create request.

Please note that this method overrides the settings for a single compilation result and does not permanently change the settings in the dataform.json file. For permanent changes, you would need to manually edit the dataform.json file.