def _grant_table_lf_permissions()

in migration/bring-your-own-s3-tables/bring_your_own_s3_table_bucket.py [0:0]


def _grant_table_lf_permissions(lf_client, s3tables_client, table_bucket_arn, namespace, table_name, project_role_arn, execute_flag):
    account_id = table_bucket_arn.split(':')[4]
    s3_table_bucket_name = table_bucket_arn.split('/')[-1]
    # Validate whether the input `Table Name` is present within S3 Table Bucket or not
    s3tables_client.get_table(
        tableBucketARN=table_bucket_arn,
        namespace=namespace,
        name=table_name
    )
    # Create permissions configuration
    permissions_input_table = {
        "Principal": {
            "DataLakePrincipalIdentifier": project_role_arn
        },
        "Resource": {
            "Table": {
                "CatalogId": f"{account_id}:s3tablescatalog/{s3_table_bucket_name}",
                "DatabaseName": namespace,