I'm trying to use @google-cloud/bigquery-storage
and it seems I can't get adapt
. This is what I'm trying to do.
const { v1, adapt } = require('@google-cloud/bigquery-storage');
const { BigQueryWriteClient } = v1;
const { BigQuery } = require('@google-cloud/bigquery');
async function BQStorageWrite() {
const bigquery = new BigQuery({ projectId: bqProjectId });
const dataset = bigquery.dataset(bqDataSetId);
const table = await dataset.table(bqTableId);
const [metadata] = await table.getMetadata();
console.log('adapt ' + adapt); // adapt undefined
console.log('v1 ' + v1); // v1 [object Object]
const storageSchema = adapt.convertBigQuerySchemaToStorageTableSchema(
metadata.schema
);
//Writing data to a BQ Table
}
adapt is undefined as per the console log, hence I get an error saying 'TypeError: Cannot read properties of undefined (reading 'convertBigQuerySchemaToStorageTableSchema')'
Am I missing something obvious here? What is the correct way to get this imported? Thank you.