/
featurestore_service.batch_read_feature_values.js
114 lines (104 loc) · 4.23 KB
/
featurestore_service.batch_read_feature_values.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
// Copyright 2024 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// ** This file is automatically generated by gapic-generator-typescript. **
// ** https://github.com/googleapis/gapic-generator-typescript **
// ** All changes to this file may be overwritten. **
'use strict';
function main(featurestore, destination, entityTypeSpecs) {
// [START aiplatform_v1beta1_generated_FeaturestoreService_BatchReadFeatureValues_async]
/**
* This snippet has been automatically generated and should be regarded as a code template only.
* It will require modifications to work.
* It may require correct/in-range values for request initialization.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Each read instance consists of exactly one read timestamp and one or more
* entity IDs identifying entities of the corresponding EntityTypes whose
* Features are requested.
* Each output instance contains Feature values of requested entities
* concatenated together as of the read time.
* An example read instance may be `foo_entity_id, bar_entity_id,
* 2020-01-01T10:00:00.123Z`.
* An example output instance may be `foo_entity_id, bar_entity_id,
* 2020-01-01T10:00:00.123Z, foo_entity_feature1_value,
* bar_entity_feature2_value`.
* Timestamp in each read instance must be millisecond-aligned.
* `csv_read_instances` are read instances stored in a plain-text CSV file.
* The header should be:
* ENTITY_TYPE_ID1, ENTITY_TYPE_ID2, ..., timestamp
* The columns can be in any order.
* Values in the timestamp column must use the RFC 3339 format, e.g.
* `2012-07-30T10:43:17.123Z`.
*/
// const csvReadInstances = {}
/**
* Similar to csv_read_instances, but from BigQuery source.
*/
// const bigqueryReadInstances = {}
/**
* Required. The resource name of the Featurestore from which to query Feature
* values. Format:
* `projects/{project}/locations/{location}/featurestores/{featurestore}`
*/
// const featurestore = 'abc123'
/**
* Required. Specifies output location and format.
*/
// const destination = {}
/**
* When not empty, the specified fields in the *_read_instances source will be
* joined as-is in the output, in addition to those fields from the
* Featurestore Entity.
* For BigQuery source, the type of the pass-through values will be
* automatically inferred. For CSV source, the pass-through values will be
* passed as opaque bytes.
*/
// const passThroughFields = [1,2,3,4]
/**
* Required. Specifies EntityType grouping Features to read values of and
* settings.
*/
// const entityTypeSpecs = [1,2,3,4]
/**
* Optional. Excludes Feature values with feature generation timestamp before
* this timestamp. If not set, retrieve oldest values kept in Feature Store.
* Timestamp, if present, must not have higher than millisecond precision.
*/
// const startTime = {}
// Imports the Aiplatform library
const {FeaturestoreServiceClient} = require('@google-cloud/aiplatform').v1beta1;
// Instantiates a client
const aiplatformClient = new FeaturestoreServiceClient();
async function callBatchReadFeatureValues() {
// Construct request
const request = {
featurestore,
destination,
entityTypeSpecs,
};
// Run request
const [operation] = await aiplatformClient.batchReadFeatureValues(request);
const [response] = await operation.promise();
console.log(response);
}
callBatchReadFeatureValues();
// [END aiplatform_v1beta1_generated_FeaturestoreService_BatchReadFeatureValues_async]
}
process.on('unhandledRejection', err => {
console.error(err.message);
process.exitCode = 1;
});
main(...process.argv.slice(2));