Skip to content

Utilities

These utilities package common actions into simple functions.

PARSE Dataset ID

Attribute Value
Name parse_dataset_id
ID bqtools.[region].parse_dataset_id
Version bqtools:v1.0.0
Description Validates a single dataset_id and parses constituent elements.
Type FUNCTION (SQL)
Arguments dataset_id STRING
Returns STRUCT<dataset_id_input STRING, is_valid BOOL, project_id STRING, dataset_name STRING>
Dependencies None

EXECUTION

DECLARE dataset_name STRING;

SET dataset_id = 'project_id.dataset_name';

SELECT bqtools.eu.parse_dataset_id(dataset_id);
DECLARE dataset_name STRING;

SET dataset_id = 'project_id.dataset_name';

SELECT bqtools.us.parse_dataset_id(dataset_id);

PARSE Resource ID

Attribute Value
Name parse_resource_id
ID bqtools.[region].parse_resource_id
Version bqtools:v1.0.0
Description Validates a single resource_id and parses constituent elements.
Type FUNCTION (SQL)
Arguments resource_id STRING
Returns STRUCT<resource_id_input STRING, is_valid BOOL, project_id STRING, dataset_name STRING, resource_name STRING, dataset_id STRING, resource_id STRING>
Dependencies None

EXECUTION

DECLARE resource_id STRING;

SET resource_id = 'project_id.dataset_name.resource_name';

SELECT bqtools.eu.parse_resource_id(resource_id);
DECLARE resource_id STRING;

SET resource_id = 'project_id.dataset_name.resource_name';

SELECT bqtools.us.parse_resource_id(resource_id);