Skip to main content

datasets

Creates, updates, deletes, gets or lists a datasets resource.

Overview

Namedatasets
TypeResource
Idgoogle.translate.datasets

Fields

The following fields are returned by SELECT queries:

Successful response

NameDatatypeDescription
namestringThe resource name of the dataset, in form of projects/{project-number-or-id}/locations/{location_id}/datasets/{dataset_id}
createTimestring (google-datetime)Output only. Timestamp when this dataset was created.
displayNamestringThe name of the dataset to show in the interface. The name can be up to 32 characters long and can consist only of ASCII Latin letters A-Z and a-z, underscores (_), and ASCII digits 0-9.
exampleCountinteger (int32)Output only. The number of examples in the dataset.
sourceLanguageCodestringThe BCP-47 language code of the source language.
targetLanguageCodestringThe BCP-47 language code of the target language.
testExampleCountinteger (int32)Output only. Number of test examples (sentence pairs).
trainExampleCountinteger (int32)Output only. Number of training examples (sentence pairs).
updateTimestring (google-datetime)Output only. Timestamp when this dataset was last updated.
validateExampleCountinteger (int32)Output only. Number of validation examples (sentence pairs).

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
projects_locations_datasets_getselectprojectsId, locationsId, datasetsIdGets a Dataset.
projects_locations_datasets_listselectprojectsId, locationsIdpageSize, pageTokenLists datasets.
projects_locations_datasets_createinsertprojectsId, locationsIdCreates a Dataset.
projects_locations_datasets_deletedeleteprojectsId, locationsId, datasetsIdDeletes a dataset and all of its contents.
projects_locations_datasets_import_dataexecprojectsId, locationsId, datasetsIdImport sentence pairs into translation Dataset.
projects_locations_datasets_export_dataexecprojectsId, locationsId, datasetsIdExports dataset's data to the provided output location.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
datasetsIdstring
locationsIdstring
projectsIdstring
pageSizeinteger (int32)
pageTokenstring

SELECT examples

Gets a Dataset.

SELECT
name,
createTime,
displayName,
exampleCount,
sourceLanguageCode,
targetLanguageCode,
testExampleCount,
trainExampleCount,
updateTime,
validateExampleCount
FROM google.translate.datasets
WHERE projectsId = '{{ projectsId }}' -- required
AND locationsId = '{{ locationsId }}' -- required
AND datasetsId = '{{ datasetsId }}' -- required;

INSERT examples

Creates a Dataset.

INSERT INTO google.translate.datasets (
data__name,
data__displayName,
data__sourceLanguageCode,
data__targetLanguageCode,
projectsId,
locationsId
)
SELECT
'{{ name }}',
'{{ displayName }}',
'{{ sourceLanguageCode }}',
'{{ targetLanguageCode }}',
'{{ projectsId }}',
'{{ locationsId }}'
RETURNING
name,
done,
error,
metadata,
response
;

DELETE examples

Deletes a dataset and all of its contents.

DELETE FROM google.translate.datasets
WHERE projectsId = '{{ projectsId }}' --required
AND locationsId = '{{ locationsId }}' --required
AND datasetsId = '{{ datasetsId }}' --required;

Lifecycle Methods

Import sentence pairs into translation Dataset.

EXEC google.translate.datasets.projects_locations_datasets_import_data 
@projectsId='{{ projectsId }}' --required,
@locationsId='{{ locationsId }}' --required,
@datasetsId='{{ datasetsId }}' --required
@@json=
'{
"inputConfig": "{{ inputConfig }}"
}';