Skip to content

Instantly share code, notes, and snippets.

@WouterNieuwerth
Created August 24, 2023 18:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save WouterNieuwerth/5a1aafe47ff6da0e23bedc8463fd48a7 to your computer and use it in GitHub Desktop.
Save WouterNieuwerth/5a1aafe47ff6da0e23bedc8463fd48a7 to your computer and use it in GitHub Desktop.
Google Workflow
main:
params: [event]
steps:
- init:
assign:
- parent: projects/[your-project]/locations/europe-west4/repositories/[your-repo]
- extract_tableId_step1: '${json.decode(base64.decode(event.data.message.data))}'
- extract_tableId_step2: '${extract_tableId_step1.protoPayload.metadata.tableCreation.table.tableName}'
- extract_tableId_step3: '${text.split(extract_tableId_step2, "/")}'
- extract_tableId_step4: '${extract_tableId_step3[len(extract_tableId_step3) -1]}'
- log:
call: sys.log
args:
text: ${extract_tableId_step4}
- createCompilationResult:
call: http.post
args:
url: ${"https://dataform.googleapis.com/v1beta1/" + parent + "/compilationResults"}
auth:
type: OAuth2
body:
gitCommitish: main
code_compilation_config:
vars:
GA4_TABLE: ${extract_tableId_step4}
result: compilationResult
- createWorkflowInvocation:
call: http.post
args:
url: ${"https://dataform.googleapis.com/v1beta1/" + parent + "/workflowInvocations"}
auth:
type: OAuth2
body:
compilationResult: ${compilationResult.body.name}
invocationConfig:
fullyRefreshIncrementalTablesEnabled: false
includedTags: ["ga4"]
includedTargets: []
transitiveDependenciesIncluded: true
transitiveDependentsIncluded: false
result: workflowInvocation
- complete:
return: ${workflowInvocation.body.name + " complete"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment