getTableInfo function
Returns table metadata for tableId.
Implementation
Future<Map<String, Object?>> getTableInfo({
required String projectId,
required String datasetId,
required String tableId,
required Object credentials,
required Object settings,
}) async {
try {
final BigQueryToolConfig toolSettings = BigQueryToolConfig.fromObject(
settings,
);
final BigQueryClient bqClient = getBigQueryClient(
project: projectId,
credentials: credentials,
location: toolSettings.location,
userAgent: <String?>[
toolSettings.applicationName,
'get_table_info',
].whereType<String>(),
);
final BigQueryResourceInfo tableInfo = await bqClient.getTable(
BigQueryTableReference(
dataset: BigQueryDatasetReference(
projectId: projectId,
datasetId: datasetId,
),
tableId: tableId,
),
);
return tableInfo.toApiRepr();
} catch (error) {
return <String, Object?>{'status': 'ERROR', 'error_details': '$error'};
}
}