The builder for Big
.
Methods
Method | Return type | Brief description |
---|---|---|
Data
|
Builds a data source specification from the settings in this builder. | |
Data
|
Creates a Data
based on this data source's settings. |
|
String
|
Gets the BigQuery dataset ID. | |
Data
|
Gets the parameters of the data source. | |
String
|
Gets the billing project ID. | |
String
|
Gets the raw query string. | |
String
|
Gets the BigQuery table ID. | |
String
|
Gets the BigQuery project ID for the table. | |
Data
|
Gets the type of the data source. | |
Big
|
Removes all the parameters. | |
Big
|
Removes the specified parameter. | |
Big
|
Sets the BigQuery dataset ID. | |
Big
|
Adds a parameter, or if the parameter with the name exists, updates its source cell for data
source spec builders of type Data
. |
|
Big
|
Sets the billing BigQuery project ID. | |
Big
|
Sets the raw query string. | |
Big
|
Sets the BigQuery table ID. | |
Big
|
Sets the BigQuery project ID for the table. |
Detailed documentation
build()
Builds a data source specification from the settings in this builder. Must use as...()
to specify a data source type before building.
The following code sample builds a BigQuery DataSource Spec.
const bigQueryDataSourceSpec = SpreadsheetApp . newDataSourceSpec (). asBigQuery (); // TODO(developer): Replace with the required dataset, project and table IDs. bigQueryDataSourceSpec . setDatasetId ( 'my data set id' ); bigQueryDataSourceSpec . setProjectId ( 'my project id' ); bigQueryDataSourceSpec . setTableId ( 'my table id' ); bigQueryDataSourceSpec . build ();
The following code sample builds a Looker DataSource Spec.
const lookerDataSourceSpecBuilder = SpreadsheetApp . newDataSourceSpec (). asLooker (); const lookerSpec = lookerDataSourceSpecBuilder . setExploreName ( 'my explore name' ) . setInstanceUrl ( 'my instance url' ) . setModelName ( 'my model name' ) . build ();
Return
Data
— The data source specification.
copy()
Creates a Data
based on this data source's settings.
// TODO(developer): Replace the URL with your own. const ss = SpreadsheetApp . openByUrl ( 'https://docs.google.com/spreadsheets/d/abc123456/edit' , ); const spec = ss . getDataSources ()[ 0 ]. getSpec (); const newSpec = spec . copy ();
Return
Data
— The builder.
get
Dataset
Id()
Gets the BigQuery dataset ID.
Return
String
— The dataset ID, or an empty string if the data source spec is defined by a raw query.
get
Parameters()
Gets the parameters of the data source.
// TODO(developer): Replace the URL with your own. const ss = SpreadsheetApp . openByUrl ( 'https://docs.google.com/spreadsheets/d/abc123456/edit' , ); const spec = ss . getDataSources ()[ 0 ]. getSpec (); const parameters = spec . getParameters ();
This method is only available for BigQuery data sources.
Return
Data
— The parameter list.
get
Project
Id()
Gets the billing project ID.
Return
String
— The project ID.
get
Raw
Query()
Gets the raw query string.
Return
String
— The raw query string.
get
Table
Id()
Gets the BigQuery table ID.
Return
String
— The table ID, or an empty string if the data source spec is defined by a raw query.
get
Table
Project
Id()
Gets the BigQuery project ID for the table.
Return
String
— The table project ID, or an empty string if the data source spec is defined by a raw
query.
get
Type()
Gets the type of the data source.
// TODO(developer): Replace the URL with your own. const ss = SpreadsheetApp . openByUrl ( 'https://docs.google.com/spreadsheets/d/abc123456/edit' , ); const spec = ss . getDataSources ()[ 0 ]. getSpec (); const type = spec . getType ();
Return
Data
— The data source type.
remove
All
Parameters()
Removes all the parameters.
const specBuilder = SpreadsheetApp . newDataSourceSpec (); specBuilder . removeAllParameters ();
Return
Big
— The builder, for chaining.
remove
Parameter(parameterName)
Removes the specified parameter.
const specBuilder = SpreadsheetApp . newDataSourceSpec (); specBuilder . removeParameter ( 'x' );
Parameters
Name | Type | Description |
---|---|---|
parameter
|
String
|
The name of the parameter to remove. |
Return
Big
— The builder, for chaining.
set
Dataset
Id(datasetId)
Sets the BigQuery dataset ID.
Parameters
Name | Type | Description |
---|---|---|
dataset
|
String
|
The ID of the dataset. |
Return
Big
— This builder, for chaining.
set
Parameter
From
Cell(parameterName, sourceCell)
Adds a parameter, or if the parameter with the name exists, updates its source cell for data
source spec builders of type Data
.
This method is only available for BigQuery data sources.
const specBuilder = SpreadsheetApp . newDataSourceSpec (). asBigQuery (); specBuilder . setParameterFromCell ( 'x' , 'A1' ); const bigQuerySpec = specBuilder . build ();
Parameters
Name | Type | Description |
---|---|---|
parameter
|
String
|
The parameter name. |
source
|
String
|
The source cell, as specified in A1 notation. |
Return
Big
— The builder, for chaining.
set
Project
Id(projectId)
Sets the billing BigQuery project ID.
Parameters
Name | Type | Description |
---|---|---|
project
|
String
|
The ID of the billing project. |
Return
Big
— The builder, for chaining.
set
Raw
Query(rawQuery)
Sets the raw query string.
Parameters
Name | Type | Description |
---|---|---|
raw
|
String
|
The raw query string. |
Return
Big
— The builder, for chaining.
set
Table
Id(tableId)
Sets the BigQuery table ID.
Parameters
Name | Type | Description |
---|---|---|
table
|
String
|
The ID of the table. |
Return
Big
— This builder, for chaining.
set
Table
Project
Id(projectId)
Sets the BigQuery project ID for the table.
Parameters
Name | Type | Description |
---|---|---|
project
|
String
|
The project ID of the BigQuery table. |
Return
Big
— The builder, for chaining.