create glue meta data tables via CDK without need crawler

0

Hi team,

I have created my glue infra with CDK, jobs, connections, crawlers, and databases,...

I need to run manually the crawler each time and then go over all generated tables by the crawler and add some catalogue table properties and change data types for some columns that have been crawled as bigint but they should be a string.

this process is tedious and tike time, is there a way to get rid of crawlers and create directly the tables via CDK with the right columns, data type, and tables properties ... or do I still need the crawlers?

can create schema catalogue tables, columns, data type, and tables properties via CDK

1回答
0

Hello there Jess, It is possible to do this using the AWS Glue construct:

https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-glue-alpha.Table.html

A quick example would be:

declare const myDatabase: glue.Database;
new glue.Table(this, 'MyTable', {
    database: myDatabase,
    tableName: 'my_table',
    columns: [{
        name: 'col1',
        type: glue.Schema.STRING,
    }],
    partitionKeys: [{
        name: 'year',
        type: glue.Schema.SMALL_INT,
    }, {
        name: 'month',
        type: glue.Schema.SMALL_INT,
    }],
    dataFormat: glue.DataFormat.JSON,
    enablePartitionFiltering: true,
});

https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-glue-alpha.Table.html

AWS
サポートエンジニア
mogeni
回答済み 2年前
AWS
エキスパート
レビュー済み 2年前

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン