Skip to main content

queries

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

Overview

Namequeries
TypeResource
Idgoogle.apigee.queries

Fields

The following fields are returned by SELECT queries:

Successful response

NameDatatypeDescription
namestringAsynchronous Query Name.
createdstringCreation time of the query.
envgroupHostnamestringHostname is available only when query is executed at host level.
errorstringError is set when query fails.
executionTimestringExecutionTime is available only after the query is completed.
queryParamsobjectContains information like metrics, dimenstions etc of the AsyncQuery. (id: GoogleCloudApigeeV1QueryMetadata)
reportDefinitionIdstringAsynchronous Report ID.
resultobjectResult is available only after the query is completed. (id: GoogleCloudApigeeV1AsyncQueryResult)
resultFileSizestringResultFileSize is available only after the query is completed.
resultRowsstring (int64)ResultRows is available only after the query is completed.
selfstringSelf link of the query. Example: /organizations/myorg/environments/myenv/queries/9cfc0d85-0f30-46d6-ae6f-318d0cb961bd or following format if query is running at host level: /organizations/myorg/hostQueries/9cfc0d85-0f30-46d6-ae6f-318d0cb961bd
statestringQuery state could be "enqueued", "running", "completed", "failed".
updatedstringLast updated timestamp for the query.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
organizations_environments_queries_getselectorganizationsId, environmentsId, queriesIdGet query status If the query is still in progress, the state is set to "running" After the query has completed successfully, state is set to "completed"
organizations_environments_queries_listselectorganizationsId, environmentsIdsubmittedBy, status, from, to, dataset, inclQueriesWithoutReportReturn a list of Asynchronous Queries
organizations_environments_queries_createinsertorganizationsId, environmentsIdSubmit a query to be processed in the background. If the submission of the query succeeds, the API returns a 201 status and an ID that refer to the query. In addition to the HTTP status 201, the state of "enqueued" means that the request succeeded.

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
environmentsIdstring
organizationsIdstring
queriesIdstring
datasetstring
fromstring
inclQueriesWithoutReportstring
statusstring
submittedBystring
tostring

SELECT examples

Get query status If the query is still in progress, the state is set to "running" After the query has completed successfully, state is set to "completed"

SELECT
name,
created,
envgroupHostname,
error,
executionTime,
queryParams,
reportDefinitionId,
result,
resultFileSize,
resultRows,
self,
state,
updated
FROM google.apigee.queries
WHERE organizationsId = '{{ organizationsId }}' -- required
AND environmentsId = '{{ environmentsId }}' -- required
AND queriesId = '{{ queriesId }}' -- required;

INSERT examples

Submit a query to be processed in the background. If the submission of the query succeeds, the API returns a 201 status and an ID that refer to the query. In addition to the HTTP status 201, the state of "enqueued" means that the request succeeded.

INSERT INTO google.apigee.queries (
data__metrics,
data__dimensions,
data__timeRange,
data__filter,
data__groupByTimeUnit,
data__limit,
data__outputFormat,
data__csvDelimiter,
data__envgroupHostname,
data__reportDefinitionId,
data__name,
organizationsId,
environmentsId
)
SELECT
'{{ metrics }}',
'{{ dimensions }}',
'{{ timeRange }}',
'{{ filter }}',
'{{ groupByTimeUnit }}',
{{ limit }},
'{{ outputFormat }}',
'{{ csvDelimiter }}',
'{{ envgroupHostname }}',
'{{ reportDefinitionId }}',
'{{ name }}',
'{{ organizationsId }}',
'{{ environmentsId }}'
RETURNING
name,
created,
envgroupHostname,
error,
executionTime,
queryParams,
reportDefinitionId,
result,
resultFileSize,
resultRows,
self,
state,
updated
;