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 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南