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

相关内容

热门资讯

技术分享!微乐自建房辅助工具脚... 技术分享!微乐自建房辅助工具脚本,微乐家乡麻将自建房辅助app(开挂自建房)器1、下载好微乐家乡麻将...
重大来袭!微乐小程序麻将自建房... 重大来袭!微乐小程序麻将自建房辅助工具插件,微乐家乡麻将自建房辅助app(开挂自建房)脚本运微乐小程...
玩家必看科普!微乐自建房辅助工... 玩家必看科普!微乐自建房辅助工具挂,微乐家乡麻将自建房辅助app(开挂自建房)技巧1)微乐家乡麻将自...
必看攻略!微乐家乡麻将自建房辅... 必看攻略!微乐家乡麻将自建房辅助app,微乐家乡麻将自建房辅助app(开挂自建房)脚本小薇(辅助器软...
科技新动态!微乐小程序麻将自建... 科技新动态!微乐小程序麻将自建房辅助工具插件,微乐自建房脚本免费入口(开挂自建房)方法1)微乐小程序...
玩家必看分享!微乐自建房辅助工... 玩家必看分享!微乐自建房辅助工具,微乐自建房脚本免费入口(开挂自建房)技巧亲,关键说明,微乐自建房辅...
重大推荐!微乐家乡麻将自建房辅... 重大推荐!微乐家乡麻将自建房辅助app,微乐小程序免费黑科技(开挂自建房)app1、点击下载安装,微...
科普攻略!微乐家乡麻将自建房辅... 科普攻略!微乐家乡麻将自建房辅助app,微乐家乡麻将自建房辅助app(开挂自建房)脚本1、不需要AI...
揭秘几款!微乐微信自建房辅助工... 揭秘几款!微乐微信自建房辅助工具插件,微乐小程序免费黑科技(开挂自建房)app1、进入游戏-大厅左侧...
今日头条!微乐自建房辅助工具神... 今日头条!微乐自建房辅助工具神器,微乐家乡麻将自建房辅助app(开挂自建房)工具1、首先打开微乐家乡...