Class BigQueryConfig

BigQueryConfig

A configuration object for a native BigQuery connector. Return this object from getData() for Data Studio to query BigQuery for the connector.

const cc = DataStudioApp.createCommunityConnector();

const bqConfig =
    cc.newBigQueryConfig()
        .setBillingProjectId('billingProjectId')
        .setQuery('queryString')
        .setUseStandardSql(true)
        .setAccessToken('accessToken')
        .addQueryParameter('dob', cc.BigQueryParameterType.STRING, '01011990')
        .build();

Methods

MethodReturn typeBrief description
addQueryParameter(name, type, value)BigQueryConfigAdds a query parameter to this BigQueryConfig.
build()ObjectValidates this object and returns it in the format needed by Data Studio.
printJson()StringPrints the JSON representation of this object.
setAccessToken(accessToken)BigQueryConfigSets the access token of this BigQueryConfig.
setBillingProjectId(billingProjectId)BigQueryConfigSets the billing project ID of this BigQueryConfig.
setQuery(query)BigQueryConfigSets the SQL query of this BigQueryConfig.
setUseStandardSql(useStandardSql)BigQueryConfigDetermines if the query is interpreted as standard or legacy SQL.

Detailed documentation

addQueryParameter(name, type, value)

Adds a query parameter to this BigQueryConfig.

Parameters

NameTypeDescription
nameStringThe parameter name.
typeBigQueryParameterTypeThe parameter type.
valueStringThe parameter value.

Return

BigQueryConfig — This object, for chaining.


build()

Validates this object and returns it in the format needed by Data Studio.

Return

Object — The validated Config object.


printJson()

Prints the JSON representation of this object. This is for debugging only.

Return

String


setAccessToken(accessToken)

Sets the access token of this BigQueryConfig.

Parameters

NameTypeDescription
accessTokenStringThe access token to set.

Return

BigQueryConfig — This object, for chaining.


setBillingProjectId(billingProjectId)

Sets the billing project ID of this BigQueryConfig.

Parameters

NameTypeDescription
billingProjectIdStringThe billing project ID to set.

Return

BigQueryConfig — This object, for chaining.


setQuery(query)

Sets the SQL query of this BigQueryConfig.

Parameters

NameTypeDescription
queryStringThe query to set.

Return

BigQueryConfig — This object, for chaining.


setUseStandardSql(useStandardSql)

Determines if the query is interpreted as standard or legacy SQL.

Parameters

NameTypeDescription
useStandardSqlBooleanIf true, the query is interpreted as standard SQL. If false, the query is interpreted as legacy SQL.

Return

BigQueryConfig — This object, for chaining.