As of January 1, 2020 this library no longer supports Python 2 on the latest released version. Library versions released prior to that date will continue to be available. For more information please visit Python 2 support on Google Cloud.

Tables

Wraps the Google Cloud Storage client library for use in tables helper.

class google.cloud.automl_v1beta1.services.tables.gcs_client.GcsClient(bucket_name=None, client=None, credentials=None, project=None)[source]

Uploads Pandas DataFrame to a bucket in Google Cloud Storage.

Constructor.

Parameters
  • bucket_name (Optional[str]) – The name of Google Cloud Storage bucket for this client to send requests to.

  • client (Optional[storage.Client]) – A Google Cloud Storage Client instance.

  • credentials (Optional[google.auth.credentials.Credentials]) – The authorization credentials to attach to requests. These credentials identify this application to the service. If none are specified, the client will attempt to ascertain the credentials from the environment.

  • project (Optional[str]) – The project ID of the GCP project to attach to the underlying storage client. If none is specified, the client will attempt to ascertain the credentials from the environment.

ensure_bucket_exists(project, region)[source]

Checks if a bucket named ‘{project}-automl-tables-staging’ exists.

If this bucket doesn’t exist, creates one. If this bucket already exists in project, do nothing. If this bucket exists in a different project that we don’t have access to, creates a bucket named ‘{project}-automl-tables-staging-{create_timestamp}’ because bucket’s name must be globally unique. Save the created bucket’s name and reuse this for future requests.

Parameters
  • project (str) – The ID of the project that stores the bucket.

  • region (str) – The region of the bucket.

Returns

A string representing the created bucket name.

upload_pandas_dataframe(dataframe, uploaded_csv_name=None)[source]

Uploads a Pandas DataFrame as CSV to the bucket.

Parameters
  • dataframe (pandas.DataFrame) – The Pandas Dataframe to be uploaded.

  • uploaded_csv_name (Optional[str]) – The name for the uploaded CSV.

Returns

A string representing the GCS URI of the uploaded CSV.

A tables helper for the google.cloud.automl_v1beta1 AutoML API

class google.cloud.automl_v1beta1.services.tables.tables_client.TablesClient(*, project=None, region='us-central1', credentials=None, client=None, prediction_client=None, gcs_client=None, **kwargs)[source]

AutoML Tables API helper.

This is intended to simplify usage of the auto-generated python client, in particular for the AutoML Tables product.

Constructor.

Example for US region:
>>> from google.cloud import automl_v1beta1
>>>
>>> from google.oauth2 import service_account
>>>
>>> client = automl_v1beta1.TablesClient(
...     credentials=service_account.Credentials.from_service_account_file('~/.gcp/account.json'),
...     project='my-project', region='us-central1')
...
Example for EU region:
>>> from google.cloud import automl_v1beta1
>>>
>>> from google.oauth2 import service_account
>>>
>>> client_options = {'api_endpoint': 'eu-automl.googleapis.com:443'}
>>> client = automl_v1beta1.TablesClient(
...     credentials=service_account.Credentials.from_service_account_file('~/.gcp/account.json'),
...     project='my-project', region='eu', client_options=client_options)
...
Parameters
  • project (Optional[str]) – The project ID of the GCP project all future calls will default to. Most methods take project as an optional parameter, and can override your choice of project supplied here.

  • region (Optional[str]) – The region all future calls will default to. Most methods take region as an optional parameter, and can override your choice of region supplied here. Note, only us-central1 is supported to-date.

  • credentials (Optional[google.auth.credentials.Credentials]) – The authorization credentials to attach to requests. These credentials identify this application to the service. If none are specified, the client will attempt to ascertain the credentials from the environment. This argument is mutually exclusive with providing a transport instance to transport; doing so will raise an exception.

  • client (Optional[google.automl_v1beta1.AutoMlClient]) – An AutoMl Client to use for requests.

  • prediction_client (Optional[google.automl_v1beta1.PredictionClient]) – A Prediction Client to use for requests.

  • gcs_client (Optional[google.automl_v1beta1.GcsClient]) – A Storage client to use for requests.

  • client_options (Union[dict, google.api_core.client_options.ClientOptions]) – Custom options for the client.

  • client_info (google.api_core.gapic_v1.client_info.ClientInfo) – The client info used to send a user-agent string along with API requests.

batch_predict(*, pandas_dataframe=None, bigquery_input_uri=None, bigquery_output_uri=None, gcs_input_uris=None, gcs_output_uri_prefix=None, model=None, model_name=None, model_display_name=None, project=None, region=None, credentials=None, inputs=None, params={}, **kwargs)[source]

Makes a batch prediction on a model. This does _not_ require the model to be deployed.

Example

>>> from google.cloud import automl_v1beta1
>>>
>>> from google.oauth2 import service_account
>>>
>>> client = automl_v1beta1.TablesClient(
...     credentials=service_account.Credentials.from_service_account_file('~/.gcp/account.json'),
...     project='my-project', region='us-central1')
...
>>> client.batch_predict(
...     gcs_input_uris='gs://inputs/input.csv',
...     gcs_output_uri_prefix='gs://outputs/',
...     model_display_name='my_model'
...  ).result()
...
Parameters
  • project (Optional[str]) – The ID of the project that owns the model. If you have initialized the client with a value for project it will be used if this parameter is not supplied. Keep in mind, the service account this client was initialized with must have access to this project.

  • region (Optional[str]) – If you have initialized the client with a value for region it will be used if this parameter is not supplied.

  • credentials (Optional[google.auth.credentials.Credentials]) – The authorization credentials to attach to requests. These credentials identify this application to the service. If none are specified, the client will attempt to ascertain the credentials from the environment.

  • pandas_dataframe (Optional[pandas.DataFrame]) – A Pandas Dataframe object containing the data you want to predict off of. The data will be converted to CSV, and this CSV will be staged to GCS in gs://{project}-automl-tables-staging/{uploaded_csv_name} This must be supplied if neither gcs_input_uris nor bigquery_input_uri is supplied.

  • gcs_input_uris (Optional(Union[List[str], str])) – Either a list of or a single GCS URI containing the data you want to predict off of. This must be supplied if neither pandas_dataframe nor bigquery_input_uri is supplied.

  • gcs_output_uri_prefix (Optional[str]) – The folder in GCS you want to write output to. This must be supplied if bigquery_output_uri is not.

  • bigquery_input_uri (Optional[str]) – The BigQuery table to input data from. This must be supplied if neither pandas_dataframe nor gcs_input_uris is supplied.

  • bigquery_output_uri (Optional[str]) – The BigQuery table to output data to. This must be supplied if gcs_output_uri_prefix is not.

  • model_display_name (Optional[str]) – The human-readable name given to the model you want to predict with. This must be supplied if model or model_name are not supplied.

  • model_name (Optional[str]) – The AutoML-assigned name given to the model you want to predict with. This must be supplied if model_display_name or model are not supplied.

  • model (Optional[model]) – The model instance you want to predict with . This must be supplied if model_display_name or model_name are not supplied.

  • params (Optional[dict]) – Additional domain-specific parameters for the predictions, any string must be up to 25000 characters long.

Returns

An operation future that can be used to check for completion synchronously or asynchronously.

Return type

google.api_core.operation.Operation

Raises
clear_test_train_column(*, dataset=None, dataset_display_name=None, dataset_name=None, project=None, region=None, **kwargs)[source]

Clears the test/train (ml_use) column which designates which data belongs to the test and train sets.

Example

>>> from google.cloud import automl_v1beta1
>>>
>>> from google.oauth2 import service_account
>>>
>>> client = automl_v1beta1.TablesClient(
...     credentials=service_account.Credentials.from_service_account_file('~/.gcp/account.json'),
...     project='my-project', region='us-central1')
...
>>> client.clear_test_train_column(dataset_display_name='my_dataset')
>>>
Parameters
  • project (Optional[str]) – The ID of the project that owns the table. If you have initialized the client with a value for project it will be used if this parameter is not supplied. Keep in mind, the service account this client was initialized with must have access to this project.

  • region (Optional[str]) – If you have initialized the client with a value for region it will be used if this parameter is not supplied.

  • dataset_display_name (Optional[str]) – The human-readable name given to the dataset you want to update the test/train column of. If no table_spec_name is supplied, this will be used together with table_spec_index to infer the name of table to update the test/train column of. This must be supplied if table_spec_name, dataset or dataset_name are not supplied.

  • dataset_name (Optional[str]) – The AutoML-assigned name given to the dataset you want to update the test/train column of. If no table_spec_name is supplied, this will be used together with table_spec_index to infer the name of table to update the test/train column of. This must be supplied if table_spec_name, dataset or dataset_display_name are not supplied.

  • dataset (Optional[Dataset]) – The Dataset instance you want to update the test/train column of. If no table_spec_name is supplied, this will be used together with table_spec_index to infer the name of table to update the test/train column of. This must be supplied if table_spec_name, dataset_name or dataset_display_name are not supplied.

Returns

A Dataset instance.

Raises
clear_time_column(*, dataset=None, dataset_display_name=None, dataset_name=None, project=None, region=None, **kwargs)[source]

Clears the time column which designates which data will be of type timestamp and will be used for the timeseries data.

Example

>>> from google.cloud import automl_v1beta1
>>>
>>> client = automl_v1beta1.TablesClient(
...     credentials=service_account.Credentials.from_service_account_file('~/.gcp/account.json'),
...     project='my-project', region='us-central1')
...
>>> client.clear_time_column(dataset_display_name='my_dataset')
>>>
Parameters
  • project (Optional[str]) – The ID of the project that owns the table. If you have initialized the client with a value for project it will be used if this parameter is not supplied. Keep in mind, the service account this client was initialized with must have access to this project.

  • region (Optional[str]) – If you have initialized the client with a value for region it will be used if this parameter is not supplied.

  • dataset_display_name (Optional[str]) – The human-readable name given to the dataset you want to update the time column of. If no table_spec_name is supplied, this will be used together with table_spec_index to infer the name of table to update the time column of. This must be supplied if table_spec_name, dataset or dataset_name are not supplied.

  • dataset_name (Optional[str]) – The AutoML-assigned name given to the dataset you want to update the time column of. If no table_spec_name is supplied, this will be used together with table_spec_index to infer the name of table to update the time column of. This must be supplied if table_spec_name, dataset or dataset_display_name are not supplied.

  • dataset (Optional[Dataset]) – The Dataset instance you want to update the time column of. If no table_spec_name is supplied, this will be used together with table_spec_index to infer the name of table to update the time column of. This must be supplied if table_spec_name, dataset_name or dataset_display_name are not supplied.

Returns

A TableSpec instance.

Raises
clear_weight_column(*, dataset=None, dataset_display_name=None, dataset_name=None, project=None, region=None, **kwargs)[source]

Clears the weight column for a given dataset.

Example

>>> from google.cloud import automl_v1beta1
>>>
>>> from google.oauth2 import service_account
>>>
>>> client = automl_v1beta1.TablesClient(
...     credentials=service_account.Credentials.from_service_account_file('~/.gcp/account.json'),
...     project='my-project', region='us-central1')
...
>>> client.clear_weight_column(dataset_display_name='my_dataset')
>>>
Parameters
  • project (Optional[str]) – The ID of the project that owns the table. If you have initialized the client with a value for project it will be used if this parameter is not supplied. Keep in mind, the service account this client was initialized with must have access to this project.

  • region (Optional[str]) – If you have initialized the client with a value for region it will be used if this parameter is not supplied.

  • dataset_display_name (Optional[str]) – The human-readable name given to the dataset you want to update the weight column of. If no table_spec_name is supplied, this will be used together with table_spec_index to infer the name of table to update the weight column of. This must be supplied if table_spec_name, dataset or dataset_name are not supplied.

  • dataset_name (Optional[str]) – The AutoML-assigned name given to the dataset you want to update the weight column of. If no table_spec_name is supplied, this will be used together with table_spec_index to infer the name of table to update the weight column of. This must be supplied if table_spec_name, dataset or dataset_display_name are not supplied.

  • dataset (Optional[Dataset]) – The Dataset instance you want to update the weight column of. If no table_spec_name is supplied, this will be used together with table_spec_index to infer the name of table to update the weight column of. This must be supplied if table_spec_name, dataset_name or dataset_display_name are not supplied.

Returns

A Dataset instance.

Raises
create_dataset(dataset_display_name, *, metadata={}, project=None, region=None, **kwargs)[source]

Create a dataset. Keep in mind, importing data is a separate step.

Example

>>> from google.cloud import automl_v1beta1
>>>
>>> from google.oauth2 import service_account
>>>
>>> client = automl_v1beta1.TablesClient(
...     credentials=service_account.Credentials.from_service_account_file('~/.gcp/account.json'),
...     project='my-project', region='us-central1')
...
>>> d = client.create_dataset(dataset_display_name='my_dataset')
>>>
Parameters
  • project (Optional[str]) – The ID of the project that will own the dataset. If you have initialized the client with a value for project it will be used if this parameter is not supplied. Keep in mind, the service account this client was initialized with must have access to this project.

  • region (Optional[str]) – If you have initialized the client with a value for region it will be used if this parameter is not supplied.

  • dataset_display_name (str) – A human-readable name to refer to this dataset by.

Returns

A Dataset instance.

Raises
create_model(model_display_name, *, dataset=None, dataset_display_name=None, dataset_name=None, train_budget_milli_node_hours=None, optimization_objective=None, project=None, region=None, model_metadata=None, include_column_spec_names=None, exclude_column_spec_names=None, disable_early_stopping=False, **kwargs)[source]

Create a model. This will train your model on the given dataset.

Example

>>> from google.cloud import automl_v1beta1
>>>
>>> from google.oauth2 import service_account
>>>
>>> client = automl_v1beta1.TablesClient(
...     credentials=service_account.Credentials.from_service_account_file('~/.gcp/account.json'),
...     project='my-project', region='us-central1')
...
>>> m = client.create_model(
...     'my_model',
...     dataset_display_name='my_dataset',
...     train_budget_milli_node_hours=1000
... )
>>>
>>> m.result() # blocks on result
>>>
Parameters
  • project (Optional[str]) – The ID of the project that will own the model. If you have initialized the client with a value for project it will be used if this parameter is not supplied. Keep in mind, the service account this client was initialized with must have access to this project.

  • region (Optional[str]) – If you have initialized the client with a value for region it will be used if this parameter is not supplied.

  • model_display_name (str) – A human-readable name to refer to this model by.

  • train_budget_milli_node_hours (int) – The amount of time (in thousandths of an hour) to spend training. This value must be between 1,000 and 72,000 inclusive (between 1 and 72 hours).

  • optimization_objective (str) – The metric AutoML tables should optimize for.

  • dataset_display_name (Optional[str]) – The human-readable name given to the dataset you want to train your model on. This must be supplied if dataset or dataset_name are not supplied.

  • dataset_name (Optional[str]) – The AutoML-assigned name given to the dataset you want to train your model on. This must be supplied if dataset_display_name or dataset are not supplied.

  • dataset (Optional[Dataset]) – The Dataset instance you want to train your model on. This must be supplied if dataset_display_name or dataset_name are not supplied.

  • model_metadata (Optional[Dict]) – Optional model metadata to supply to the client.

  • include_column_spec_names (Optional[str]) – The list of the names of the columns you want to include to train your model on.

  • exclude_column_spec_names (Optional[str]) – The list of the names of the columns you want to exclude and not train your model on.

  • disable_early_stopping (Optional[bool]) – True if disable early stopping. By default, the early stopping feature is enabled, which means that AutoML Tables might stop training before the entire training budget has been used.

Returns

An operation future that can be used to check for completion synchronously or asynchronously.

Return type

google.api_core.operation.Operation

Raises
delete_dataset(*, dataset=None, dataset_display_name=None, dataset_name=None, project=None, region=None, **kwargs)[source]

Deletes a dataset. This does not delete any models trained on this dataset.

Example

>>> from google.cloud import automl_v1beta1
>>>
>>> from google.oauth2 import service_account
>>>
>>> client = automl_v1beta1.TablesClient(
...     credentials=service_account.Credentials.from_service_account_file('~/.gcp/account.json'),
...     project='my-project', region='us-central1')
...
>>> op = client.delete_dataset(dataset_display_name='my_dataset')
>>>
>>> op.result() # blocks on delete request
>>>
Parameters
  • project (Optional[str]) – The ID of the project that owns the dataset. If you have initialized the client with a value for project it will be used if this parameter is not supplied. Keep in mind, the service account this client was initialized with must have access to this project.

  • region (Optional[str]) – If you have initialized the client with a value for region it will be used if this parameter is not supplied.

  • dataset_display_name (Optional[str]) – The human-readable name given to the dataset you want to delete. This must be supplied if dataset or dataset_name are not supplied.

  • dataset_name (Optional[str]) – The AutoML-assigned name given to the dataset you want to delete. This must be supplied if dataset_display_name or dataset are not supplied.

  • dataset (Optional[Dataset]) – The Dataset instance you want to delete. This must be supplied if dataset_display_name or dataset_name are not supplied.

Returns

An operation future that can be used to check for completion synchronously or asynchronously.

Return type

google.api_core.operation.Operation

Raises
delete_model(*, model=None, model_display_name=None, model_name=None, project=None, region=None, **kwargs)[source]

Deletes a model. Note this will not delete any datasets associated with this model.

Example

>>> from google.cloud import automl_v1beta1
>>>
>>> from google.oauth2 import service_account
>>>
>>> client = automl_v1beta1.TablesClient(
...     credentials=service_account.Credentials.from_service_account_file('~/.gcp/account.json'),
...     project='my-project', region='us-central1')
...
>>> op = client.delete_model(model_display_name='my_model')
>>>
>>> op.result() # blocks on delete request
>>>
Parameters
  • project (Optional[str]) – The ID of the project that owns the model. If you have initialized the client with a value for project it will be used if this parameter is not supplied. Keep in mind, the service account this client was initialized with must have access to this project.

  • region (Optional[str]) – If you have initialized the client with a value for region it will be used if this parameter is not supplied.

  • model_display_name (Optional[str]) – The human-readable name given to the model you want to delete. This must be supplied if model or model_name are not supplied.

  • model_name (Optional[str]) – The AutoML-assigned name given to the model you want to delete. This must be supplied if model_display_name or model are not supplied.

  • model (Optional[model]) – The model instance you want to delete. This must be supplied if model_display_name or model_name are not supplied.

Returns

An operation future that can be used to check for completion synchronously or asynchronously.

Return type

google.api_core.operation.Operation

Raises
deploy_model(*, model=None, model_name=None, model_display_name=None, project=None, region=None, **kwargs)[source]

Deploys a model. This allows you make online predictions using the model you’ve deployed.

Example

>>> from google.cloud import automl_v1beta1
>>>
>>> from google.oauth2 import service_account
>>>
>>> client = automl_v1beta1.TablesClient(
...     credentials=service_account.Credentials.from_service_account_file('~/.gcp/account.json'),
...     project='my-project', region='us-central1')
...
>>> op = client.deploy_model(model_display_name='my_model')
>>>
>>> op.result() # blocks on deploy request
>>>
Parameters
  • project (Optional[str]) – The ID of the project that owns the model. If you have initialized the client with a value for project it will be used if this parameter is not supplied. Keep in mind, the service account this client was initialized with must have access to this project.

  • region (Optional[str]) – If you have initialized the client with a value for region it will be used if this parameter is not supplied.

  • model_display_name (Optional[str]) – The human-readable name given to the model you want to deploy. This must be supplied if model or model_name are not supplied.

  • model_name (Optional[str]) – The AutoML-assigned name given to the model you want to deploy. This must be supplied if model_display_name or model are not supplied.

  • model (Optional[model]) – The model instance you want to deploy. This must be supplied if model_display_name or model_name are not supplied.

Returns

An operation future that can be used to check for completion synchronously or asynchronously.

Return type

google.api_core.operation.Operation

Raises
export_data(*, dataset=None, dataset_display_name=None, dataset_name=None, gcs_output_uri_prefix=None, bigquery_output_uri=None, project=None, region=None, **kwargs)[source]

Exports data from a dataset.

Example

>>> from google.cloud import automl_v1beta1
>>>
>>> from google.oauth2 import service_account
>>>
>>> client = automl_v1beta1.TablesClient(
...     credentials=service_account.Credentials.from_service_account_file('~/.gcp/account.json'),
...     project='my-project', region='us-central1')
...
>>> d = client.create_dataset(dataset_display_name='my_dataset')
>>>
>>> response = client.export_data(dataset=d,
...     gcs_output_uri_prefix='gs://cloud-ml-tables-data/bank-marketing.csv')
...
>>> def callback(operation_future):
...    result = operation_future.result()
...
>>> response.add_done_callback(callback)
>>>
Parameters
  • project (Optional[str]) – The ID of the project that owns the dataset. If you have initialized the client with a value for project it will be used if this parameter is not supplied. Keep in mind, the service account this client was initialized with must have access to this project.

  • region (Optional[str]) – If you have initialized the client with a value for region it will be used if this parameter is not supplied.

  • dataset_display_name (Optional[str]) – The human-readable name given to the dataset you want to export data from. This must be supplied if dataset or dataset_name are not supplied.

  • dataset_name (Optional[str]) – The AutoML-assigned name given to the dataset you want to export data from. This must be supplied if dataset_display_name or dataset are not supplied.

  • dataset (Optional[Dataset]) – The Dataset instance you want to export data from. This must be supplied if dataset_display_name or dataset_name are not supplied.

  • gcs_output_uri_prefix (Optional[Union[str, Sequence[str]]]) – A single gs://.. prefixed URI to export to. This must be supplied if bigquery_output_uri is not.

  • bigquery_output_uri (Optional[str]) – A URI pointing to the BigQuery table containing the data to export. This must be supplied if gcs_output_uri_prefix is not.

Returns

An operation future that can be used to check for completion synchronously or asynchronously.

Return type

google.api_core.operation.Operation

Raises
get_column_spec(column_spec_name, *, project=None, region=None, **kwargs)[source]

Gets a single column spec in a particular project and region.

Example

>>> from google.cloud import automl_v1beta1
>>>
>>> from google.oauth2 import service_account
>>>
>>> client = automl_v1beta1.TablesClient(
...     credentials=service_account.Credentials.from_service_account_file('~/.gcp/account.json'),
...     project='my-project', region='us-central1')
...
>>> d = client.get_column_spec('my_column_spec')
>>>
Parameters
  • column_spec_name (str) – This is the fully-qualified name generated by the AutoML API for this column spec.

  • project (Optional[str]) – The ID of the project that owns the column. If you have initialized the client with a value for project it will be used if this parameter is not supplied. Keep in mind, the service account this client was initialized with must have access to this project.

  • region (Optional[str]) – If you have initialized the client with a value for region it will be used if this parameter is not supplied.

Returns

A ColumnSpec instance.

Raises
get_dataset(*, project=None, region=None, dataset_name=None, dataset_display_name=None, **kwargs)[source]

Gets a single dataset in a particular project and region.

Example

>>> from google.cloud import automl_v1beta1
>>>
>>> from google.oauth2 import service_account
>>>
>>> client = automl_v1beta1.TablesClient(
...     credentials=service_account.Credentials.from_service_account_file('~/.gcp/account.json'),
...     project='my-project', region='us-central1')
...
>>> d = client.get_dataset(dataset_display_name='my_dataset')
>>>
Parameters
  • project (Optional[str]) – The ID of the project that owns the dataset. If you have initialized the client with a value for project it will be used if this parameter is not supplied. Keep in mind, the service account this client was initialized with must have access to this project.

  • region (Optional[str]) – If you have initialized the client with a value for region it will be used if this parameter is not supplied.

  • dataset_name (Optional[str]) – This is the fully-qualified name generated by the AutoML API for this dataset. This is not to be confused with the human-assigned dataset_display_name that is provided when creating a dataset. Either dataset_name or dataset_display_name must be provided.

  • dataset_display_name (Optional[str]) – This is the name you provided for the dataset when first creating it. Either dataset_name or dataset_display_name must be provided.

Returns

A Dataset instance if found, None otherwise.

Raises
get_model(*, project=None, region=None, model_name=None, model_display_name=None, **kwargs)[source]

Gets a single model in a particular project and region.

Example

>>> from google.cloud import automl_v1beta1
>>>
>>> from google.oauth2 import service_account
>>>
>>> client = automl_v1beta1.TablesClient(
...     credentials=service_account.Credentials.from_service_account_file('~/.gcp/account.json'),
...     project='my-project', region='us-central1')
...
>>> d = client.get_model(model_display_name='my_model')
>>>
Parameters
  • project (Optional[str]) – The ID of the project that owns the model. If you have initialized the client with a value for project it will be used if this parameter is not supplied. Keep in mind, the service account this client was initialized with must have access to this project.

  • region (Optional[str]) – If you have initialized the client with a value for region it will be used if this parameter is not supplied.

  • model_name (Optional[str]) – This is the fully-qualified name generated by the AutoML API for this model. This is not to be confused with the human-assigned model_display_name that is provided when creating a model. Either model_name or model_display_name must be provided.

  • model_display_name (Optional[str]) – This is the name you provided for the model when first creating it. Either model_name or model_display_name must be provided.

Returns

A Model instance.

Raises
get_model_evaluation(model_evaluation_name, *, project=None, region=None, **kwargs)[source]

Gets a single evaluation model in a particular project and region.

Example

>>> from google.cloud import automl_v1beta1
>>>
>>> from google.oauth2 import service_account
>>>
>>> client = automl_v1beta1.TablesClient(
...     credentials=service_account.Credentials.from_service_account_file('~/.gcp/account.json'),
...     project='my-project', region='us-central1')
...
>>> d = client.get_model_evaluation('my_model_evaluation')
>>>
Parameters
  • model_evaluation_name (str) – This is the fully-qualified name generated by the AutoML API for this model evaluation.

  • project (Optional[str]) – The ID of the project that owns the model. If you have initialized the client with a value for project it will be used if this parameter is not supplied. Keep in mind, the service account this client was initialized with must have access to this project.

  • region (Optional[str]) – If you have initialized the client with a value for region it will be used if this parameter is not supplied.

Returns

A ModelEvaluation instance.

Raises
get_table_spec(table_spec_name, *, project=None, region=None, **kwargs)[source]

Gets a single table spec in a particular project and region.

Example

>>> from google.cloud import automl_v1beta1
>>>
>>> from google.oauth2 import service_account
>>>
>>> client = automl_v1beta1.TablesClient(
...     credentials=service_account.Credentials.from_service_account_file('~/.gcp/account.json'),
...     project='my-project', region='us-central1')
...
>>> d = client.get_table_spec('my_table_spec')
>>>
Parameters
  • table_spec_name (str) – This is the fully-qualified name generated by the AutoML API for this table spec.

  • project (Optional[str]) – The ID of the project that owns the table. If you have initialized the client with a value for project it will be used if this parameter is not supplied. Keep in mind, the service account this client was initialized with must have access to this project.

  • region (Optional[str]) – If you have initialized the client with a value for region it will be used if this parameter is not supplied.

Returns

A TableSpec instance.

Raises
import_data(*, dataset=None, dataset_display_name=None, dataset_name=None, pandas_dataframe=None, gcs_input_uris=None, bigquery_input_uri=None, project=None, region=None, credentials=None, **kwargs)[source]

Imports data into a dataset.

Example

>>> from google.cloud import automl_v1beta1
>>>
>>> from google.oauth2 import service_account
>>>
>>> client = automl_v1beta1.TablesClient(
...     credentials=service_account.Credentials.from_service_account_file('~/.gcp/account.json'),
...     project='my-project', region='us-central1')
...
>>> d = client.create_dataset(dataset_display_name='my_dataset')
>>>
>>> response = client.import_data(dataset=d,
...     gcs_input_uris='gs://cloud-ml-tables-data/bank-marketing.csv')
...
>>> def callback(operation_future):
...    result = operation_future.result()
...
>>> response.add_done_callback(callback)
>>>
Parameters
  • project (Optional[str]) – The ID of the project that owns the dataset. If you have initialized the client with a value for project it will be used if this parameter is not supplied. Keep in mind, the service account this client was initialized with must have access to this project.

  • region (Optional[str]) – If you have initialized the client with a value for region it will be used if this parameter is not supplied.

  • credentials (Optional[google.auth.credentials.Credentials]) – The authorization credentials to attach to requests. These credentials identify this application to the service. If none are specified, the client will attempt to ascertain the credentials from the environment.

  • dataset_display_name (Optional[str]) – The human-readable name given to the dataset you want to import data into. This must be supplied if dataset or dataset_name are not supplied.

  • dataset_name (Optional[str]) – The AutoML-assigned name given to the dataset you want to import data into. This must be supplied if dataset_display_name or dataset are not supplied.

  • dataset (Optional[Dataset]) – The Dataset instance you want to import data into. This must be supplied if dataset_display_name or dataset_name are not supplied.

  • pandas_dataframe (Optional[pandas.DataFrame]) – A Pandas Dataframe object containing the data to import. The data will be converted to CSV, and this CSV will be staged to GCS in gs://{project}-automl-tables-staging/{uploaded_csv_name} This parameter must be supplied if neither gcs_input_uris nor bigquery_input_uri is supplied.

  • gcs_input_uris (Optional[Union[str, Sequence[str]]]) – Either a single gs://.. prefixed URI, or a list of URIs referring to GCS-hosted CSV files containing the data to import. This must be supplied if neither bigquery_input_uri nor pandas_dataframe is supplied.

  • bigquery_input_uri (Optional[str]) – A URI pointing to the BigQuery table containing the data to import. This must be supplied if neither gcs_input_uris nor pandas_dataframe is supplied.

Returns

An operation future that can be used to check for completion synchronously or asynchronously.

Return type

google.api_core.operation.Operation

Raises
list_column_specs(*, dataset=None, dataset_display_name=None, dataset_name=None, table_spec_name=None, table_spec_index=0, project=None, region=None, **kwargs)[source]

Lists column specs.

Example

>>> from google.cloud import automl_v1beta1
>>>
>>> from google.oauth2 import service_account
>>>
>>> client = automl_v1beta1.TablesClient(
...     credentials=service_account.Credentials.from_service_account_file('~/.gcp/account.json'),
...     project='my-project', region='us-central1')
...
>>> for s in client.list_column_specs(dataset_display_name='my_dataset')
...     # process the spec
...     pass
...
Parameters
  • project (Optional[str]) – The ID of the project that owns the columns. If you have initialized the client with a value for project it will be used if this parameter is not supplied. Keep in mind, the service account this client was initialized with must have access to this project.

  • region (Optional[str]) – If you have initialized the client with a value for region it will be used if this parameter is not supplied.

  • table_spec_name (Optional[str]) – The AutoML-assigned name for the table whose specs you want to read. If not supplied, the client can determine this name from a source Dataset object.

  • table_spec_index (Optional[int]) – If no table_spec_name was provided, we use this index to determine which table to read column specs from.

  • dataset_display_name (Optional[str]) – The human-readable name given to the dataset you want to read specs from. If no table_spec_name is supplied, this will be used together with table_spec_index to infer the name of table to read specs from. This must be supplied if table_spec_name, dataset or dataset_name are not supplied.

  • dataset_name (Optional[str]) – The AutoML-assigned name given to the dataset you want to read specs from. If no table_spec_name is supplied, this will be used together with table_spec_index to infer the name of table to read specs from. This must be supplied if table_spec_name, dataset or dataset_display_name are not supplied.

  • dataset (Optional[Dataset]) – The Dataset instance you want to read specs from. If no table_spec_name is supplied, this will be used together with table_spec_index to infer the name of table to read specs from. This must be supplied if table_spec_name, dataset_name or dataset_display_name are not supplied.

Returns

A PageIterator instance. An iterable of ColumnSpec instances. You can also iterate over the pages of the response using its pages property.

Raises
list_datasets(*, project=None, region=None, **kwargs)[source]

List all datasets in a particular project and region.

Example

>>> from google.cloud import automl_v1beta1
>>>
>>> from google.oauth2 import service_account
>>>
>>> client = automl_v1beta1.TablesClient(
...     credentials=service_account.Credentials.from_service_account_file('~/.gcp/account.json'),
...     project='my-project', region='us-central1')
...
>>> ds = client.list_datasets()
>>>
>>> for d in ds:
...     # do something
...     pass
...
Parameters
  • project (Optional[str]) – The ID of the project that owns the datasets. If you have initialized the client with a value for project it will be used if this parameter is not supplied. Keep in mind, the service account this client was initialized with must have access to this project.

  • region (Optional[str]) – If you have initialized the client with a value for region it will be used if this parameter is not supplied.

Returns

A PageIterator instance. An iterable of Dataset instances. You can also iterate over the pages of the response using its pages property.

Raises
list_model_evaluations(*, project=None, region=None, model=None, model_display_name=None, model_name=None, **kwargs)[source]

List all model evaluations for a given model.

Example

>>> from google.cloud import automl_v1beta1
>>>
>>> from google.oauth2 import service_account
>>>
>>> client = automl_v1beta1.TablesClient(
...     credentials=service_account.Credentials.from_service_account_file('~/.gcp/account.json'),
...     project='my-project', region='us-central1')
...
>>> ms = client.list_model_evaluations(model_display_name='my_model')
>>>
>>> for m in ms:
...     # do something
...     pass
...
Parameters
  • project (Optional[str]) – The ID of the project that owns the model. If you have initialized the client with a value for project it will be used if this parameter is not supplied. Keep in mind, the service account this client was initialized with must have access to this project.

  • region (Optional[str]) – If you have initialized the client with a value for region it will be used if this parameter is not supplied.

  • model_display_name (Optional[str]) – The human-readable name given to the model you want to list evaluations for. This must be supplied if model or model_name are not supplied.

  • model_name (Optional[str]) – The AutoML-assigned name given to the model you want to list evaluations for. This must be supplied if model_display_name or model are not supplied.

  • model (Optional[model]) – The model instance you want to list evaluations for. This must be supplied if model_display_name or model_name are not supplied.

Returns

A PageIterator instance. An iterable of ModelEvaluation instances. You can also iterate over the pages of the response using its pages property.

For a regression model, there will only be one evaluation. For a classification model there will be on for each classification label, as well as one for micro-averaged metrics. See more documentation here: https://cloud.google.com/automl-tables/docs/evaluate#automl-tables-list-model-evaluations-cli-curl:w

Raises
list_models(*, project=None, region=None, **kwargs)[source]

List all models in a particular project and region.

Example

>>> from google.cloud import automl_v1beta1
>>>
>>> from google.oauth2 import service_account
>>>
>>> client = automl_v1beta1.TablesClient(
...     credentials=service_account.Credentials.from_service_account_file('~/.gcp/account.json'),
...     project='my-project', region='us-central1')
...
>>> ms = client.list_models()
>>>
>>> for m in ms:
...     # do something
...     pass
...
Parameters
  • project (Optional[str]) – The ID of the project that owns the models. If you have initialized the client with a value for project it will be used if this parameter is not supplied. Keep in mind, the service account this client was initialized with must have access to this project.

  • region (Optional[str]) – If you have initialized the client with a value for region it will be used if this parameter is not supplied.

Returns

A PageIterator instance. An iterable of Model instances. You can also iterate over the pages of the response using its pages property.

Raises
list_table_specs(*, dataset=None, dataset_display_name=None, dataset_name=None, project=None, region=None, **kwargs)[source]

Lists table specs.

Example

>>> from google.cloud import automl_v1beta1
>>>
>>> from google.oauth2 import service_account
>>>
>>> client = automl_v1beta1.TablesClient(
...     credentials=service_account.Credentials.from_service_account_file('~/.gcp/account.json'),
...     project='my-project', region='us-central1')
...
>>> for s in client.list_table_specs(dataset_display_name='my_dataset')
...     # process the spec
...     pass
...
Parameters
  • project (Optional[str]) – The ID of the project that owns the dataset. If you have initialized the client with a value for project it will be used if this parameter is not supplied. Keep in mind, the service account this client was initialized with must have access to this project.

  • region (Optional[str]) – If you have initialized the client with a value for region it will be used if this parameter is not supplied.

  • dataset_display_name (Optional[str]) – The human-readable name given to the dataset you want to read specs from. This must be supplied if dataset or dataset_name are not supplied.

  • dataset_name (Optional[str]) – The AutoML-assigned name given to the dataset you want to read specs from. This must be supplied if dataset_display_name or dataset are not supplied.

  • dataset (Optional[Dataset]) – The Dataset instance you want to read specs from. This must be supplied if dataset_display_name or dataset_name are not supplied.

Returns

A PageIterator instance. An iterable of TableSpec instances. You can also iterate over the pages of the response using its pages property.

Raises
predict(inputs, *, model=None, model_name=None, model_display_name=None, feature_importance=False, project=None, region=None, **kwargs)[source]

Makes a prediction on a deployed model. This will fail if the model was not deployed.

Example

>>> from google.cloud import automl_v1beta1
>>>
>>> from google.oauth2 import service_account
>>>
>>> client = automl_v1beta1.TablesClient(
...     credentials=service_account.Credentials.from_service_account_file('~/.gcp/account.json'),
...     project='my-project', region='us-central1')
...
>>> client.predict(inputs={'Age': 30, 'Income': 12, 'Category': 'A'}
...     model_display_name='my_model')
...
>>> client.predict([30, 12, 'A'], model_display_name='my_model')
>>>
Parameters
  • project (Optional[str]) – The ID of the project that owns the model. If you have initialized the client with a value for project it will be used if this parameter is not supplied. Keep in mind, the service account this client was initialized with must have access to this project.

  • region (Optional[str]) – If you have initialized the client with a value for region it will be used if this parameter is not supplied.

  • inputs (Union[List[str], Dict[str, str]]) – Either the sorted list of column values to predict with, or a key-value map of column display name to value to predict with.

  • model_display_name (Optional[str]) – The human-readable name given to the model you want to predict with. This must be supplied if model or model_name are not supplied.

  • model_name (Optional[str]) – The AutoML-assigned name given to the model you want to predict with. This must be supplied if model_display_name or model are not supplied.

  • model (Optional[model]) – The model instance you want to predict with . This must be supplied if model_display_name or model_name are not supplied.

  • feature_importance (bool) – True if enable feature importance explainability. The default is False.

Returns

A PredictResponse instance.

Raises
set_target_column(*, dataset=None, dataset_display_name=None, dataset_name=None, table_spec_name=None, table_spec_index=0, column_spec_name=None, column_spec_display_name=None, project=None, region=None, **kwargs)[source]

Sets the target column for a given table.

Example

>>> from google.cloud import automl_v1beta1
>>>
>>> from google.oauth2 import service_account
>>>
>>> client = automl_v1beta1.TablesClient(
...     credentials=service_account.Credentials.from_service_account_file('~/.gcp/account.json'),
...     project='my-project', region='us-central1')
...
>>> client.set_target_column(dataset_display_name='my_dataset',
...     column_spec_display_name='Income')
...
Parameters
  • project (Optional[str]) – The ID of the project that owns the table. If you have initialized the client with a value for project it will be used if this parameter is not supplied. Keep in mind, the service account this client was initialized with must have access to this project.

  • region (Optional[str]) – If you have initialized the client with a value for region it will be used if this parameter is not supplied.

  • column_spec_name (Optional[str]) – The name AutoML-assigned name for the column you want to set as the target column.

  • column_spec_display_name (Optional[str]) – The human-readable name of the column you want to set as the target column. If this is supplied in place of column_spec_name, you also need to provide either a way to lookup the source dataset (using one of the dataset* kwargs), or the table_spec_name of the table this column belongs to.

  • table_spec_name (Optional[str]) – The AutoML-assigned name for the table whose target column you want to set . If not supplied, the client can determine this name from a source Dataset object.

  • table_spec_index (Optional[int]) – If no table_spec_name or column_spec_name was provided, we use this index to determine which table to set the target column on.

  • dataset_display_name (Optional[str]) – The human-readable name given to the dataset you want to update the target column of. If no table_spec_name is supplied, this will be used together with table_spec_index to infer the name of table to update the target column of. This must be supplied if table_spec_name, dataset or dataset_name are not supplied.

  • dataset_name (Optional[str]) – The AutoML-assigned name given to the dataset you want to update the target column of. If no table_spec_name is supplied, this will be used together with table_spec_index to infer the name of table to update the target column of. This must be supplied if table_spec_name, dataset or dataset_display_name are not supplied.

  • dataset (Optional[Dataset]) – The Dataset instance you want to update the target column of. If no table_spec_name is supplied, this will be used together with table_spec_index to infer the name of table to update the target column of. This must be supplied if table_spec_name, dataset_name or dataset_display_name are not supplied.

Returns

A Dataset instance.

Raises
set_test_train_column(*, dataset=None, dataset_display_name=None, dataset_name=None, table_spec_name=None, table_spec_index=0, column_spec_name=None, column_spec_display_name=None, project=None, region=None, **kwargs)[source]

Sets the test/train (ml_use) column which designates which data belongs to the test and train sets. This column must be categorical.

Example

>>> from google.cloud import automl_v1beta1
>>>
>>> from google.oauth2 import service_account
>>>
>>> client = automl_v1beta1.TablesClient(
...     credentials=service_account.Credentials.from_service_account_file('~/.gcp/account.json'),
...     project='my-project', region='us-central1')
...
>>> client.set_test_train_column(dataset_display_name='my_dataset',
...     column_spec_display_name='TestSplit')
...
Parameters
  • project (Optional[str]) – The ID of the project that owns the table. If you have initialized the client with a value for project it will be used if this parameter is not supplied. Keep in mind, the service account this client was initialized with must have access to this project.

  • region (Optional[str]) – If you have initialized the client with a value for region it will be used if this parameter is not supplied.

  • column_spec_name (Optional[str]) – The name AutoML-assigned name for the column you want to set as the test/train column.

  • column_spec_display_name (Optional[str]) – The human-readable name of the column you want to set as the test/train column. If this is supplied in place of column_spec_name, you also need to provide either a way to lookup the source dataset (using one of the dataset* kwargs), or the table_spec_name of the table this column belongs to.

  • table_spec_name (Optional[str]) – The AutoML-assigned name for the table whose test/train column you want to set . If not supplied, the client can determine this name from a source Dataset object.

  • table_spec_index (Optional[int]) – If no table_spec_name or column_spec_name was provided, we use this index to determine which table to set the test/train column on.

  • dataset_display_name (Optional[str]) – The human-readable name given to the dataset you want to update the test/train column of. If no table_spec_name is supplied, this will be used together with table_spec_index to infer the name of table to update the test/train column of. This must be supplied if table_spec_name, dataset or dataset_name are not supplied.

  • dataset_name (Optional[str]) – The AutoML-assigned name given to the dataset you want to update the test/train column of. If no table_spec_name is supplied, this will be used together with table_spec_index to infer the name of table to update the test/train column of. This must be supplied if table_spec_name, dataset or dataset_display_name are not supplied.

  • dataset (Optional[Dataset]) – The Dataset instance you want to update the test/train column of. If no table_spec_name is supplied, this will be used together with table_spec_index to infer the name of table to update the test/train column of. This must be supplied if table_spec_name, dataset_name or dataset_display_name are not supplied.

Returns

A Dataset instance.

Raises
set_time_column(*, dataset=None, dataset_display_name=None, dataset_name=None, table_spec_name=None, table_spec_index=0, column_spec_name=None, column_spec_display_name=None, project=None, region=None, **kwargs)[source]

Sets the time column which designates which data will be of type timestamp and will be used for the timeseries data. This column must be of type timestamp.

Example

>>> from google.cloud import automl_v1beta1
>>>
>>> client = automl_v1beta1.TablesClient(
...     credentials=service_account.Credentials.from_service_account_file('~/.gcp/account.json'),
...     project='my-project', region='us-central1')
...
>>> client.set_time_column(dataset_display_name='my_dataset',
...     column_spec_display_name='Unix Time')
...
Parameters
  • project (Optional[str]) – The ID of the project that owns the table. If you have initialized the client with a value for project it will be used if this parameter is not supplied. Keep in mind, the service account this client was initialized with must have access to this project.

  • region (Optional[str]) – If you have initialized the client with a value for region it will be used if this parameter is not supplied.

  • column_spec_name (Optional[str]) – The name AutoML-assigned name for the column you want to set as the time column.

  • column_spec_display_name (Optional[str]) – The human-readable name of the column you want to set as the time column. If this is supplied in place of column_spec_name, you also need to provide either a way to lookup the source dataset (using one of the dataset* kwargs), or the table_spec_name of the table this column belongs to.

  • table_spec_name (Optional[str]) – The AutoML-assigned name for the table whose time column you want to set . If not supplied, the client can determine this name from a source Dataset object.

  • table_spec_index (Optional[int]) – If no table_spec_name or column_spec_name was provided, we use this index to determine which table to set the time column on.

  • dataset_display_name (Optional[str]) – The human-readable name given to the dataset you want to update the time column of. If no table_spec_name is supplied, this will be used together with table_spec_index to infer the name of table to update the time column of. This must be supplied if table_spec_name, dataset or dataset_name are not supplied.

  • dataset_name (Optional[str]) – The AutoML-assigned name given to the dataset you want to update the time column of. If no table_spec_name is supplied, this will be used together with table_spec_index to infer the name of table to update the time column of. This must be supplied if table_spec_name, dataset or dataset_display_name are not supplied.

  • dataset (Optional[Dataset]) – The Dataset instance you want to update the time column of. If no table_spec_name is supplied, this will be used together with table_spec_index to infer the name of table to update the time column of. This must be supplied if table_spec_name, dataset_name or dataset_display_name are not supplied.

Returns

A TableSpec instance.

Raises
set_weight_column(*, dataset=None, dataset_display_name=None, dataset_name=None, table_spec_name=None, table_spec_index=0, column_spec_name=None, column_spec_display_name=None, project=None, region=None, **kwargs)[source]

Sets the weight column for a given table.

Example

>>> from google.cloud import automl_v1beta1
>>>
>>> from google.oauth2 import service_account
>>>
>>> client = automl_v1beta1.TablesClient(
...     credentials=service_account.Credentials.from_service_account_file('~/.gcp/account.json'),
...     project='my-project', region='us-central1')
...
>>> client.set_weight_column(dataset_display_name='my_dataset',
...     column_spec_display_name='Income')
...
Parameters
  • project (Optional[str]) – The ID of the project that owns the table. If you have initialized the client with a value for project it will be used if this parameter is not supplied. Keep in mind, the service account this client was initialized with must have access to this project.

  • region (Optional[str]) – If you have initialized the client with a value for region it will be used if this parameter is not supplied.

  • column_spec_name (Optional[str]) – The name AutoML-assigned name for the column you want to set as the weight column.

  • column_spec_display_name (Optional[str]) – The human-readable name of the column you want to set as the weight column. If this is supplied in place of column_spec_name, you also need to provide either a way to lookup the source dataset (using one of the dataset* kwargs), or the table_spec_name of the table this column belongs to.

  • table_spec_name (Optional[str]) – The AutoML-assigned name for the table whose weight column you want to set . If not supplied, the client can determine this name from a source Dataset object.

  • table_spec_index (Optional[int]) – If no table_spec_name or column_spec_name was provided, we use this index to determine which table to set the weight column on.

  • dataset_display_name (Optional[str]) – The human-readable name given to the dataset you want to update the weight column of. If no table_spec_name is supplied, this will be used together with table_spec_index to infer the name of table to update the weight column of. This must be supplied if table_spec_name, dataset or dataset_name are not supplied.

  • dataset_name (Optional[str]) – The AutoML-assigned name given to the dataset you want to update the weight column of. If no table_spec_name is supplied, this will be used together with table_spec_index to infer the name of table to update the weight column of. This must be supplied if table_spec_name, dataset or dataset_display_name are not supplied.

  • dataset (Optional[Dataset]) – The Dataset instance you want to update the weight column of. If no table_spec_name is supplied, this will be used together with table_spec_index to infer the name of table to update the weight column of. This must be supplied if table_spec_name, dataset_name or dataset_display_name are not supplied.

Returns

A Dataset instance.

Raises
undeploy_model(*, model=None, model_name=None, model_display_name=None, project=None, region=None, **kwargs)[source]

Undeploys a model.

Example

>>> from google.cloud import automl_v1beta1
>>>
>>> from google.oauth2 import service_account
>>>
>>> client = automl_v1beta1.TablesClient(
...     credentials=service_account.Credentials.from_service_account_file('~/.gcp/account.json'),
...     project='my-project', region='us-central1')
...
>>> op = client.undeploy_model(model_display_name='my_model')
>>>
>>> op.result() # blocks on undeploy request
>>>
Parameters
  • project (Optional[str]) – The ID of the project that owns the model. If you have initialized the client with a value for project it will be used if this parameter is not supplied. Keep in mind, the service account this client was initialized with must have access to this project.

  • region (Optional[str]) – If you have initialized the client with a value for region it will be used if this parameter is not supplied.

  • model_display_name (Optional[str]) – The human-readable name given to the model you want to undeploy. This must be supplied if model or model_name are not supplied.

  • model_name (Optional[str]) – The AutoML-assigned name given to the model you want to undeploy. This must be supplied if model_display_name or model are not supplied.

  • model (Optional[model]) – The model instance you want to undeploy. This must be supplied if model_display_name or model_name are not supplied.

Returns

An operation future that can be used to check for completion synchronously or asynchronously.

Return type

google.api_core.operation.Operation

Raises
update_column_spec(*, dataset=None, dataset_display_name=None, dataset_name=None, table_spec_name=None, table_spec_index=0, column_spec_name=None, column_spec_display_name=None, type_code=None, nullable=None, project=None, region=None, **kwargs)[source]

Updates a column’s specs.

Example

>>> from google.cloud import automl_v1beta1
>>>
>>> from google.oauth2 import service_account
>>>
>>> client = automl_v1beta1.TablesClient(
...     credentials=service_account.Credentials.from_service_account_file('~/.gcp/account.json'),
...     project='my-project', region='us-central1')
...
>>> client.update_column_spec(dataset_display_name='my_dataset',
...     column_spec_display_name='Outcome',
...     type_code=automl_v1beta1.TypeCode.CATEGORY)
...
Parameters
  • dataset (Optional[Dataset]) – The Dataset instance you want to update specs on. If no table_spec_name is supplied, this will be used together with table_spec_index to infer the name of table to update specs on. This must be supplied if table_spec_name, dataset_name or dataset_display_name are not supplied.

  • dataset_display_name (Optional[str]) – The human-readable name given to the dataset you want to update specs on. If no table_spec_name is supplied, this will be used together with table_spec_index to infer the name of table to update specs on. This must be supplied if table_spec_name, dataset or dataset_name are not supplied.

  • dataset_name (Optional[str]) – The AutoML-assigned name given to the dataset you want to update specs one. If no table_spec_name is supplied, this will be used together with table_spec_index to infer the name of table to update specs on. This must be supplied if table_spec_name, dataset or dataset_display_name are not supplied.

  • table_spec_name (Optional[str]) – The AutoML-assigned name for the table whose specs you want to update. If not supplied, the client can determine this name from a source Dataset object.

  • table_spec_index (Optional[int]) – If no table_spec_name was provided, we use this index to determine which table to update column specs on.

  • column_spec_name (Optional[str]) – The name AutoML-assigned name for the column you want to update.

  • column_spec_display_name (Optional[str]) – The human-readable name of the column you want to update. If this is supplied in place of column_spec_name, you also need to provide either a way to lookup the source dataset (using one of the dataset* kwargs), or the table_spec_name of the table this column belongs to.

  • type_code (Optional[str]) – The desired ‘type_code’ of the column. For more information on the available types, please see the documentation: https://cloud.google.com/automl-tables/docs/reference/rpc/google.cloud.automl.v1beta1#typecode

  • nullable (Optional[bool]) – Set to True or False to specify if this column’s value must expected to be present in all rows or not.

  • project (Optional[str]) – The ID of the project that owns the columns. If you have initialized the client with a value for project it will be used if this parameter is not supplied. Keep in mind, the service account this client was initialized with must have access to this project.

  • region (Optional[str]) – If you have initialized the client with a value for region it will be used if this parameter is not supplied.

Returns

A ColumnSpec instance.

Raises
google.cloud.automl_v1beta1.services.tables.tables_client.to_proto_value(value)[source]

translates a Python value to a google.protobuf.Value.

Parameters

value – The Python value to be translated.

Returns

Tuple of the translated google.protobuf.Value and error if any.