AWSCDKLakeFormation:数据单元格过滤必须具有列名称或列通配符
创始人
2024-09-24 02:30:34
0

使用AWS CDK创建数据湖时,如果您在指定数据表的数据单元格过滤器时未指定列名或列通配符,则会出现该错误。解决此问题的方法是在数据单元格过滤器中指定列名或列通配符。

以下是一个使用AWS CDK创建数据湖并指定数据单元格过滤器和列名的示例代码:

from aws_cdk import (
    core,
    aws_lakeformation as lakeformation,
    aws_glue as glue
)

class DataLakeStack(core.Stack):

    def __init__(self, scope: core.Construct, id: str, **kwargs) -> None:
        super().__init__(scope, id, **kwargs)

        # Create a database
        database = glue.Database(self, "my-db",
                        database_name="my_database",
                        description="My database")

        # Create a table
        table = glue.Table(self, "my-table",
                    database=database,
                    table_name="my_table",
                    description="My table",
                    columns=[{'name': 'col1', 'type': glue.Schema.STRING},
                            {'name': 'col2', 'type': glue.Schema.STRING}],
                    partition_keys=[{'name': 'partition_key', 'type': glue.Schema.STRING}],
                    data_format=glue.DataFormat.PARQUET)

        # Create a resource with the table name and permissions
        resource_with_permissions = lakeformation.CfnResource(self, "my-resource",
                                    resource_arn=table.table_arn,
                                    role_arn="arn:aws:iam::123456789012:role/my-lf-role",
                                    use_service_linked_role=False,
                                    database_resource=lakeformation.CfnResource.DatabaseResourceProperty(name=database.database_name))

        # Add a data cell filter with the column name
        lakeformation.CfnPermissions(self, "my-permission",
                    permissions=lakeformation.CfnPermissions.DatabasePermissionsProperty(
                                    permissions=["SELECT"],
                                    data_location=lakeformation.CfnPermissions.DataLocationProperty(
                                                resource_arn=resource_with_permissions.attr_arn,
                                                s3_location=lakeformation.CfnPermissions.S

相关内容

热门资讯

科技透视"wepok... 科技透视"wepoker挂是真的吗"开挂(透视)辅助器(一分钟了解教你攻略)科技透视"wepoker...
第2分钟辅助!牵手跑得软件,顺... 顺欣茶楼辅助软件是一款专注玩家量身打造的游戏记牌类型软件,在顺欣茶楼辅助软件这款游戏中我们可以记录下...
推荐透视"wepok... 推荐透视"wepoker透视方法"开挂(透视)辅助工具(终于清楚软件教程)推荐透视"wepoker透...
第九分钟辅助!欢乐对决辅助软件... 【亲,欢乐对决辅助软件 这款游戏可以开挂的,确实是有挂的,很多玩家在这款欢乐对决辅助软件中打牌都会发...
关于透视"wepok... 关于透视"wepoker技巧攻略"开挂(透视)辅助工具(三分钟了解我来教教你)关于透视"wepoke...
第十分钟透视!腾威互娱破解辅助... 第十分钟透视!腾威互娱破解辅助工具,newpoker怎么安装脚本(分享一款开挂辅助软件);无需打开直...
7分钟开挂!萍乡打滚筒六副攻略... 7分钟开挂!萍乡打滚筒六副攻略,云扑克有透视吗(透视模拟器开挂辅助平台);打开点击测试直接进入微信(...
细节透视"WePoK... 细节透视"WePoKer透视插件方法"开挂(透视)辅助挂(一分钟了解2026版教程)细节透视"WeP...
科技透视"wepok... 科技透视"wepoker透视挂真的假的"开挂(透视)辅助插件(2分钟细说曝光教程)科技透视"wepo...
八分钟辅助!途游四川麻将辅助器... 八分钟辅助!途游四川麻将辅助器软件,九酷互娱辅助(分享开挂内幕开挂辅助软件);无需打开直接搜索打开薇...