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:

Successful response

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.

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.
projects_templates_getselectprojectIdgcsPath, view, locationGet 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.
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.
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.
projects_templates_launchexecprojectIdvalidateOnly, gcsPath, dynamicTemplate.gcsPath, dynamicTemplate.stagingLocation, locationLaunches 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.
projects_locations_templates_launchexecprojectId, locationvalidateOnly, gcsPath, dynamicTemplate.gcsPath, dynamicTemplate.stagingLocationLaunches 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.

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.

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.

INSERT INTO google.dataflow.templates (
data__jobName,
data__gcsPath,
data__parameters,
data__environment,
data__location,
projectId,
location
)
SELECT
'{{ jobName }}',
'{{ gcsPath }}',
'{{ parameters }}',
'{{ environment }}',
'{{ location }}',
'{{ projectId }}',
'{{ location }}'
RETURNING
id,
name,
clientRequestId,
createTime,
createdFromSnapshotId,
currentState,
currentStateTime,
environment,
executionInfo,
jobMetadata,
labels,
location,
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.

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