Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/amazon-web-services/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/kotlin/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python AWS湖泊形成:授予“权限:资源中的未知参数。表:”;表通配符“;_Python_Amazon Web Services_Boto3_Aws Lake Formation - Fatal编程技术网

Python AWS湖泊形成:授予“权限:资源中的未知参数。表:”;表通配符“;

Python AWS湖泊形成:授予“权限:资源中的未知参数。表:”;表通配符“;,python,amazon-web-services,boto3,aws-lake-formation,Python,Amazon Web Services,Boto3,Aws Lake Formation,试图通过Lambda函数授予lake权限。(Python 3.8) 据我所见,我的代码与文档一致。 然而,关于参数不正确的胡说八道的错误接踵而至。 是不是我只需要一个验光师? 或者是一些细微的差别,或者是今天亚马逊风的方向 import boto3 import json from botocore.exceptions import ClientError def main(event,context): client = boto3.client('lakeformation')

试图通过Lambda函数授予lake权限。(Python 3.8) 据我所见,我的代码与文档一致。 然而,关于参数不正确的胡说八道的错误接踵而至。 是不是我只需要一个验光师? 或者是一些细微的差别,或者是今天亚马逊风的方向

import boto3
import json
from botocore.exceptions import ClientError

def main(event,context):

    client = boto3.client('lakeformation')

    response = client.grant_permissions(
        Principal={
            'DataLakePrincipalIdentifier': 'arn:aws:iam::123456789012:role/myRole'
        },
        Resource={
            'Table': {
                'DatabaseName': 'myDatabase',
                'TableWildcard': {}
            },
        },
        Permissions=['ALL'],
        PermissionsWithGrantOption=['ALL']
    )
       
======================================================================================

[错误]ParamValidationError:参数验证失败:缺少 资源中的必需参数。表中的“名称”未知参数 表:“TableWildcard”,必须是以下之一:DatabaseName,Name 回溯(最近一次调用):文件“/var/task/main.py”,第行 总的来说是10 response=client.grant_permissions(文件“/var/runtime/botocore/client.py”),第316行,在api_调用中 返回self.\u make\u api\u调用(操作名称,kwargs)文件“/var/runtime/botocore/client.py”,第607行,在\u make\u api\u调用中 request_dict=self.\u将_转换为_request_dict(文件“/var/runtime/botocore/client.py”,第655行,在 _将请求转换为请求 request\u dict=self.\u serializer.serialize\u to\u请求(文件“/var/runtime/botocore/validate.py”),第297行,在serialize\u to\u请求中 raise ParamValidationError(report=report.generate_report())


我稍微研究了一下这个问题。错误是因为在lambda上,
tableresources
的定义是(注意lambda上缺少的
TableWildcard
):


在我看来,这是一个错误。

您使用的boto3的哪个版本?是最新版本吗?抱歉,它以lambda运行,设置为Python 3.8。这似乎是lambda的问题。我在lambda上也有相同的错误。但它在本地工作站上工作。啊哈!因此lambda上Boto的Vsn对于API来说不够新。鉴于此,我发现了一个a关于如何将Boto的新vsn作为层添加到Lambda中的文章。我现在需要做的就是找到这些说明的Windows版本;)@SimonB让我知道它将如何进行。层将是解决此问题的好方法。
    "TableResource":{
      "type":"structure",
      "required":[
        "DatabaseName",
        "Name"
      ],
      "members":{
        "DatabaseName":{
          "shape":"NameString",
          "documentation":"<p>The name of the database for the table. Unique to a Data Catalog. A database is a set of associated table definitions organized into a logical group. You can Grant and Revoke database privileges to a principal. </p>"
        },
        "Name":{
          "shape":"NameString",
          "documentation":"<p>The name of the table.</p>"
        }
      },
      "documentation":"<p>A structure for the table object. A table is a metadata definition that represents your data. You can Grant and Revoke table privileges to a principal. </p>"
    }
    "TableResource":{
      "type":"structure",
      "required":["DatabaseName"],
      "members":{
        "CatalogId":{
          "shape":"CatalogIdString",
          "documentation":"<p>The identifier for the Data Catalog. By default, it is the account ID of the caller.</p>"
        },
        "DatabaseName":{
          "shape":"NameString",
          "documentation":"<p>The name of the database for the table. Unique to a Data Catalog. A database is a set of associated table definitions organized into a logical group. You can Grant and Revoke database privileges to a principal. </p>"
        },
        "Name":{
          "shape":"NameString",
          "documentation":"<p>The name of the table.</p>"
        },
        "TableWildcard":{
          "shape":"TableWildcard",
          "documentation":"<p>A wildcard object representing every table under a database.</p> <p>At least one of <code>TableResource$Name</code> or <code>TableResource$TableWildcard</code> is required.</p>"
        }
      }