Skip to main content

query_templates

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

Overview

Namequery_templates
TypeResource
Idgoogle.analyticshub.query_templates

Fields

The following fields are returned by SELECT queries:

Successful response

NameDatatypeDescription
namestringOutput only. The resource name of the QueryTemplate. e.g. projects/myproject/locations/us/dataExchanges/123/queryTemplates/456
createTimestring (google-datetime)Output only. Timestamp when the QueryTemplate was created.
descriptionstringOptional. Short description of the QueryTemplate. The description must not contain Unicode non-characters and C0 and C1 control codes except tabs (HT), new lines (LF), carriage returns (CR), and page breaks (FF). Default value is an empty string. Max length: 2000 bytes.
displayNamestringRequired. Human-readable display name of the QueryTemplate. The display name must contain only Unicode letters, numbers (0-9), underscores (_), dashes (-), spaces ( ), ampersands (&) and can't start or end with spaces. Default value is an empty string. Max length: 63 bytes.
documentationstringOptional. Documentation describing the QueryTemplate.
primaryContactstringOptional. Email or URL of the primary point of contact of the QueryTemplate. Max Length: 1000 bytes.
proposerstringOptional. Will be deprecated. Email or URL of the primary point of contact of the QueryTemplate. Max Length: 1000 bytes.
routineobjectOptional. The routine associated with the QueryTemplate. (id: Routine)
statestringOutput only. The QueryTemplate lifecycle state.
updateTimestring (google-datetime)Output only. Timestamp when the QueryTemplate was last modified.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
projects_locations_data_exchanges_query_templates_getselectprojectsId, locationsId, dataExchangesId, queryTemplatesIdGets a QueryTemplate
projects_locations_data_exchanges_query_templates_listselectprojectsId, locationsId, dataExchangesIdpageSize, pageTokenLists all QueryTemplates in a given project and location.
projects_locations_data_exchanges_query_templates_createinsertprojectsId, locationsId, dataExchangesIdqueryTemplateIdCreates a new QueryTemplate
projects_locations_data_exchanges_query_templates_patchupdateprojectsId, locationsId, dataExchangesId, queryTemplatesIdupdateMaskUpdates an existing QueryTemplate
projects_locations_data_exchanges_query_templates_deletedeleteprojectsId, locationsId, dataExchangesId, queryTemplatesIdDeletes a query template.
projects_locations_data_exchanges_query_templates_submitexecprojectsId, locationsId, dataExchangesId, queryTemplatesIdSubmits a query template for approval.
projects_locations_data_exchanges_query_templates_approveexecprojectsId, locationsId, dataExchangesId, queryTemplatesIdApproves a query template.

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
dataExchangesIdstring
locationsIdstring
projectsIdstring
queryTemplatesIdstring
pageSizeinteger (int32)
pageTokenstring
queryTemplateIdstring
updateMaskstring (google-fieldmask)

SELECT examples

Gets a QueryTemplate

SELECT
name,
createTime,
description,
displayName,
documentation,
primaryContact,
proposer,
routine,
state,
updateTime
FROM google.analyticshub.query_templates
WHERE projectsId = '{{ projectsId }}' -- required
AND locationsId = '{{ locationsId }}' -- required
AND dataExchangesId = '{{ dataExchangesId }}' -- required
AND queryTemplatesId = '{{ queryTemplatesId }}' -- required;

INSERT examples

Creates a new QueryTemplate

INSERT INTO google.analyticshub.query_templates (
data__displayName,
data__description,
data__proposer,
data__primaryContact,
data__documentation,
data__routine,
projectsId,
locationsId,
dataExchangesId,
queryTemplateId
)
SELECT
'{{ displayName }}',
'{{ description }}',
'{{ proposer }}',
'{{ primaryContact }}',
'{{ documentation }}',
'{{ routine }}',
'{{ projectsId }}',
'{{ locationsId }}',
'{{ dataExchangesId }}',
'{{ queryTemplateId }}'
RETURNING
name,
createTime,
description,
displayName,
documentation,
primaryContact,
proposer,
routine,
state,
updateTime
;

UPDATE examples

Updates an existing QueryTemplate

UPDATE google.analyticshub.query_templates
SET
data__displayName = '{{ displayName }}',
data__description = '{{ description }}',
data__proposer = '{{ proposer }}',
data__primaryContact = '{{ primaryContact }}',
data__documentation = '{{ documentation }}',
data__routine = '{{ routine }}'
WHERE
projectsId = '{{ projectsId }}' --required
AND locationsId = '{{ locationsId }}' --required
AND dataExchangesId = '{{ dataExchangesId }}' --required
AND queryTemplatesId = '{{ queryTemplatesId }}' --required
AND updateMask = '{{ updateMask}}'
RETURNING
name,
createTime,
description,
displayName,
documentation,
primaryContact,
proposer,
routine,
state,
updateTime;

DELETE examples

Deletes a query template.

DELETE FROM google.analyticshub.query_templates
WHERE projectsId = '{{ projectsId }}' --required
AND locationsId = '{{ locationsId }}' --required
AND dataExchangesId = '{{ dataExchangesId }}' --required
AND queryTemplatesId = '{{ queryTemplatesId }}' --required;

Lifecycle Methods

Submits a query template for approval.

EXEC google.analyticshub.query_templates.projects_locations_data_exchanges_query_templates_submit 
@projectsId='{{ projectsId }}' --required,
@locationsId='{{ locationsId }}' --required,
@dataExchangesId='{{ dataExchangesId }}' --required,
@queryTemplatesId='{{ queryTemplatesId }}' --required;