BigQuery Client - Class Dataset (1.31.1)

Reference documentation and code samples for the BigQuery Client class Dataset.

Datasets allow you to organize and control access to your tables.

Namespace

Google \ Cloud \ BigQuery

Methods

__construct

Parameters
NameDescription
connectionConnection\ConnectionInterface

Represents a connection to BigQuery. This object is created by BigQueryClient, and should not be instantiated outside of this client.

idstring

The dataset's ID.

projectIdstring

The project's ID.

mapperValueMapper
infoarray

[optional] The dataset's metadata.

locationstring|null

[optional] A default geographic location, used when no dataset metadata exists.

exists

Check whether or not the dataset exists.

Example:

echo $dataset->exists();
Returns
TypeDescription
bool

delete

Parameters
NameDescription
optionsarray

Configuration options.

↳ deleteContentsbool

If true, delete all the tables in the dataset. If false and the dataset contains tables, the request will fail. Defaults to false.

update

Parameters
NameDescription
metadataarray

The available options for metadata are outlined at the Dataset Resource API docs

optionsarray

[optional] Configuration options.

table

Lazily instantiates a table.

There are no network requests made at this point. To see the operations that can be performed on a dataset please see Table.

Example:

$table = $dataset->table('myTableId');
Parameter
NameDescription
idstring

The id of the table to request.

Returns
TypeDescription
Table

tables

Parameters
NameDescription
optionsarray

Configuration options.

↳ maxResultsint

Maximum number of results to return per page.

↳ resultLimitint

Limit the number of results returned in total. Defaults to 0 (return all results).

↳ pageTokenstring

A previously-returned page token used to resume the loading of results from a specific point.

Returns
TypeDescription
Google\Cloud\Core\Iterator\ItemIterator<Table>

createTable

Parameters
NameDescription
idmixed
optionsarray

Configuration options.

↳ metadataarray

The available options for metadata are outlined at the Table Resource API docs

Returns
TypeDescription
Table

model

Lazily instantiates a machine learning model in the dataset.

There are no network requests made at this point. To see the operations that can be performed on a model, please see Model.

Example:

$model = $dataset->model('my_model');
echo $model->id();
Parameters
NameDescription
idstring

The model's ID.

infoarray

[optional] The model resource data.

Returns
TypeDescription
Model

models

Parameters
NameDescription
optionsarray

Configuration options.

↳ maxResultsint

Maximum number of results to return per page.

↳ resultLimitint

Limit the number of results returned in total. Defaults to 0 (return all results).

↳ pageTokenstring

A previously-returned page token used to resume the loading of results from a specific point.

Returns
TypeDescription
Google\Cloud\Core\Iterator\ItemIterator<Model>

routine

Lazily instantiates a routine.

There are no network requests made at this point. To see the operations that can be performed on a routine, please see Routine.

Example:

$routine = $dataset->routine('my_routine');
echo $routine->identity()['routineId'];
Parameters
NameDescription
idstring

The routine's ID.

infoarray

[optional] The routine resource data.

Returns
TypeDescription
Routine

routines

Parameters
NameDescription
optionsarray

Configuration options.

↳ maxResultsint

Maximum number of results to return per page.

↳ resultLimitint

Limit the number of results returned in total. Defaults to 0 (return all results).

↳ pageTokenstring

A previously-returned page token used to resume the loading of results from a specific point.

Returns
TypeDescription
Google\Cloud\Core\Iterator\ItemIterator<Model>

createRoutine

Parameters
NameDescription
idstring

The routine ID.

metadataarray

The available options for metadata are outlined at the Routine Resource API docs. Omit routineReference as it is computed and appended by the client.

optionsarray

[optional] Configuration options.

Returns
TypeDescription
Routine

info

Parameter
NameDescription
optionsarray

[optional] Configuration options.

Returns
TypeDescription
array

reload

Parameter
NameDescription
optionsarray

[optional] Configuration options.

Returns
TypeDescription
array

id

Retrieves the dataset's ID.

Example:

echo $dataset->id();
Returns
TypeDescription
string

identity

Retrieves the dataset's identity.

An identity provides a description of a resource that is nested in nature.

Example:

echo $dataset->identity()['projectId'];
Returns
TypeDescription
array