MCPcopy Create free account
hub / github.com/GoogleCloudPlatform/nodejs-docs-samples / main

Function main

automl/export_dataset.js:17–57  ·  view source on GitHub ↗
(
  projectId = 'YOUR_PROJECT_ID',
  location = 'us-central1',
  datasetId = 'YOUR_DATASET_ID',
  gcsUri = 'gs://BUCKET_ID/path_to_export/'
)

Source from the content-addressed store, hash-verified

15'use strict';
16
17function main(
18 projectId = 'YOUR_PROJECT_ID',
19 location = 'us-central1',
20 datasetId = 'YOUR_DATASET_ID',
21 gcsUri = 'gs://BUCKET_ID/path_to_export/'
22) {
23 // [START automl_export_dataset]
24 /**
25 * TODO(developer): Uncomment these variables before running the sample.
26 */
27 // const projectId = 'YOUR_PROJECT_ID';
28 // const location = 'us-central1';
29 // const datasetId = 'YOUR_DATASET_ID';
30 // const gcsUri = 'gs://BUCKET_ID/path_to_export/';
31
32 // Imports the Google Cloud AutoML library
33 const {AutoMlClient} = require('@google-cloud/automl').v1;
34
35 // Instantiates a client
36 const client = new AutoMlClient();
37
38 async function exportDataset() {
39 // Construct request
40 const request = {
41 name: client.datasetPath(projectId, location, datasetId),
42 outputConfig: {
43 gcsDestination: {
44 outputUriPrefix: gcsUri,
45 },
46 },
47 };
48
49 const [operation] = await client.exportData(request);
50 // Wait for operation to complete.
51 const [response] = await operation.promise();
52 console.log(`Dataset exported: ${response}`);
53 }
54
55 exportDataset();
56 // [END automl_export_dataset]
57}
58
59process.on('unhandledRejection', err => {
60 console.error(err.message);

Callers 1

export_dataset.jsFile · 0.70

Calls 1

exportDatasetFunction · 0.85

Tested by

no test coverage detected