Skip to main content

templates

Creates, updates, deletes, gets or lists a templates resource.

Overview​

Nametemplates
TypeResource
Idgoogle.dataflow.templates

Fields​

The following fields are returned by SELECT queries:

NameDatatypeDescription
metadataobjectThe template metadata describing the template name, available parameters, etc. (id: TemplateMetadata)
runtimeMetadataobjectDescribes the runtime metadata with SDKInfo and available parameters. (id: RuntimeMetadata)
statusobjectThe status of the get template request. Any problems with the request will be indicated in the error_details. (id: Status)
templateTypestringTemplate Type. (UNKNOWN, LEGACY, FLEX)

Methods​

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
projects_locations_templates_getselectprojectId, locationgcsPath, viewGet the template associated with a template. To get the template, we recommend using projects.locations.templates.get with a [regional endpoint] (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints). Using projects.templates.get is not recommended, because only templates that are running in us-central1 are retrieved. # IAM Permissions Requires the resourcemanager.projects.get permission on the project.
projects_templates_getselectprojectIdgcsPath, location, viewGet the template associated with a template. To get the template, we recommend using projects.locations.templates.get with a [regional endpoint] (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints). Using projects.templates.get is not recommended, because only templates that are running in us-central1 are retrieved. # IAM Permissions Requires the resourcemanager.projects.get permission on the project.
projects_locations_templates_createinsertprojectId, locationCreates a Cloud Dataflow job from a template. Do not enter confidential information when you supply string values using the API. To create a job, we recommend using projects.locations.templates.create with a [regional endpoint] (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints). Using projects.templates.create is not recommended, because your job will always start in us-central1. # IAM Permissions Requires the following IAM permission(s) on the project: - dataflow.jobs.create - resourcemanager.projects.get
projects_templates_createinsertprojectIdCreates a Cloud Dataflow job from a template. Do not enter confidential information when you supply string values using the API. To create a job, we recommend using projects.locations.templates.create with a [regional endpoint] (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints). Using projects.templates.create is not recommended, because your job will always start in us-central1. # IAM Permissions Requires the following IAM permission(s) on the project: - dataflow.jobs.create - resourcemanager.projects.get
projects_locations_templates_launchexecprojectId, locationdynamicTemplate.gcsPath, dynamicTemplate.stagingLocation, gcsPath, validateOnlyLaunches a template. To launch a template, we recommend using projects.locations.templates.launch with a [regional endpoint] (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints). Using projects.templates.launch is not recommended, because jobs launched from the template will always start in us-central1. # IAM Permissions Requires the following IAM permission(s) on the project: - dataflow.jobs.create - resourcemanager.projects.get
projects_templates_launchexecprojectIddynamicTemplate.gcsPath, dynamicTemplate.stagingLocation, gcsPath, location, validateOnlyLaunches a template. To launch a template, we recommend using projects.locations.templates.launch with a [regional endpoint] (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints). Using projects.templates.launch is not recommended, because jobs launched from the template will always start in us-central1. # IAM Permissions Requires the following IAM permission(s) on the project: - dataflow.jobs.create - resourcemanager.projects.get

Parameters​

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
locationstring
projectIdstring
dynamicTemplate.gcsPathstring
dynamicTemplate.stagingLocationstring
gcsPathstring
locationstring
validateOnlyboolean
viewstring

SELECT examples​

Get the template associated with a template. To get the template, we recommend using projects.locations.templates.get with a [regional endpoint] (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints). Using projects.templates.get is not recommended, because only templates that are running in us-central1 are retrieved. # IAM Permissions Requires the resourcemanager.projects.get permission on the project.

SELECT
metadata,
runtimeMetadata,
status,
templateType
FROM google.dataflow.templates
WHERE projectId = '{{ projectId }}' -- required
AND location = '{{ location }}' -- required
AND gcsPath = '{{ gcsPath }}'
AND view = '{{ view }}'
;

INSERT examples​

Creates a Cloud Dataflow job from a template. Do not enter confidential information when you supply string values using the API. To create a job, we recommend using projects.locations.templates.create with a [regional endpoint] (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints). Using projects.templates.create is not recommended, because your job will always start in us-central1. # IAM Permissions Requires the following IAM permission(s) on the project: - dataflow.jobs.create - resourcemanager.projects.get

INSERT INTO google.dataflow.templates (
data__environment,
data__gcsPath,
data__jobName,
data__location,
data__parameters,
projectId,
location
)
SELECT
'{{ environment }}',
'{{ gcsPath }}',
'{{ jobName }}',
'{{ location }}',
'{{ parameters }}',
'{{ projectId }}',
'{{ location }}'
RETURNING
id,
name,
clientRequestId,
createTime,
createdFromSnapshotId,
currentState,
currentStateTime,
environment,
executionInfo,
jobMetadata,
labels,
location,
pausable,
pipelineDescription,
projectId,
replaceJobId,
replacedByJobId,
requestedState,
runtimeUpdatableParams,
satisfiesPzi,
satisfiesPzs,
serviceResources,
stageStates,
startTime,
steps,
stepsLocation,
tempFiles,
transformNameMapping,
type
;

Lifecycle Methods​

Launches a template. To launch a template, we recommend using projects.locations.templates.launch with a [regional endpoint] (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints). Using projects.templates.launch is not recommended, because jobs launched from the template will always start in us-central1. # IAM Permissions Requires the following IAM permission(s) on the project: - dataflow.jobs.create - resourcemanager.projects.get

EXEC google.dataflow.templates.projects_locations_templates_launch
@projectId='{{ projectId }}' --required,
@location='{{ location }}' --required,
@dynamicTemplate.gcsPath='{{ dynamicTemplate.gcsPath }}',
@dynamicTemplate.stagingLocation='{{ dynamicTemplate.stagingLocation }}',
@gcsPath='{{ gcsPath }}',
@validateOnly={{ validateOnly }}
@@json=
'{
"environment": "{{ environment }}",
"jobName": "{{ jobName }}",
"parameters": "{{ parameters }}",
"transformNameMapping": "{{ transformNameMapping }}",
"update": {{ update }}
}'
;