列仕様の取得

列仕様の取得を実施する

コードサンプル

Node.js

AutoML Tables に対する認証を行うには、アプリケーションのデフォルト認証情報を設定します。詳細については、ローカル開発環境の認証の設定をご覧ください。

const automl = require('@google-cloud/automl');
const client = new automl.v1beta1.AutoMlClient();

/**
 * Demonstrates using the AutoML client to get all column specs
 * information in table colums.
 * TODO(developer): Uncomment the following lines before running the sample.
 */
// const projectId = '[PROJECT_ID]' e.g., "my-gcloud-project";
// const computeRegion = '[REGION_NAME]' e.g., "us-central1";
// const datasetId = '[DATASET_ID]' e.g., "TBL2246891593778855936";
// const tableId = '[TABLE_ID]' e.g., "1991013247762825216"`;
// const columnId = '[COLUMN_ID]' e.g., "773141392279994368";

// Get the full path of the column.
const columnSpecId = client.columnSpecPath(
  projectId,
  computeRegion,
  datasetId,
  tableId,
  columnId
);

// Get all the information about a given columnSpec of a particular
// table in a dataset.
client
  .getColumnSpec({name: columnSpecId})
  .then(responses => {
    const column = responses[0];
    // Display the column spec information.
    console.log(`Column name: ${column.name}`);
    console.log(`Column Id: ${column.name.split('/').pop(-1)}`);
    console.log(`Column display name: ${column.displayName}`);
    console.log(`Column datatype: ${column.dataType.typeCode}`);
    console.log(
      `Column distinct value count: ${column.dataStats.distinctValueCount}`
    );
  })
  .catch(err => {
    console.error(err);
  });

次のステップ

他の Google Cloud プロダクトに関連するコードサンプルの検索およびフィルタ検索を行うには、Google Cloud のサンプルをご覧ください。