简体   繁体   English

我想使用 python 中的 boto3 将 DynamoDB 表从一个帐户复制到另一个帐户。 但出现错误

[英]I want to copy DynamoDB table from one account to another using boto3 in python. but error is showing up

I am using code below in python.我在 python 中使用下面的代码。

import boto3
import os

dynamoclient = boto3.client('dynamodb', region_name='eu-west-1',
    aws_access_key_id='ACCESS_KEY_SOURCE',
    aws_secret_access_key='SECRET_KEY_SOURCE')

dynamotargetclient = boto3.client('dynamodb', region_name='us-west-1',
    aws_access_key_id='ACCESS_KEY_TARGET',
    aws_secret_access_key='SECRET_KEY_TARGET')

dynamopaginator = dynamoclient.get_paginator('scan')
tabname='SOURCE_TABLE_NAME'
targettabname='TARGET_TABLE_NAME'
dynamoresponse = dynamopaginator.paginate(
    TableName=tabname,
    Select='ALL_ATTRIBUTES',
    ReturnConsumedCapacity='NONE',
    ConsistentRead=True
)
for page in dynamoresponse:
    for item in page['Items']:
        dynamotargetclient.put_item(
            TableName=targettabname,
            Item=item
        )

but while running this I am facing an error below.但是在运行此程序时,我在下面遇到错误。

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\ADMIN\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\botocore\paginate.py", line 255, in __iter__
    response = self._make_request(current_kwargs)
  File "C:\Users\ADMIN\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\botocore\paginate.py", line 332, in _make_request
    return self._method(**current_kwargs)
  File "C:\Users\ADMIN\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\botocore\client.py", line 316, in _api_call
    return self._make_api_call(operation_name, kwargs)
  File "C:\Users\ADMIN\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\botocore\client.py", line 635, in _make_api_call
    raise error_class(parsed_response, operation_name)
botocore.errorfactory.ResourceNotFoundException: An error occurred (ResourceNotFoundException) when calling the Scan operation: Requested resource not found

I have no idea why this error is showing.我不知道为什么会显示此错误。 I am newbie to python.我是 python 的新手。 Any help would be appreciated.任何帮助,将不胜感激。 Thank!!!感谢!!!

Are you sure that source table exists in that region?您确定该区域中存在源表吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用 boto3 在 python 中使用另一个现有表的结构创建 DynamoDB 表时出错 - Error while creating DynamoDB table using another existing table's structure in python using boto3 如何使用 boto3 仅使用 python 将更改的文件从一个 S3 存储桶复制到另一个存储桶? - How can I copy only changed files from one S3 Bucket to another one with python using boto3? 使用AWS Lambda中的Boto3将一个帐户中的S3存储桶复制到另一个帐户中的S3存储桶 - Copy from S3 bucket in one account to S3 bucket in another account using Boto3 in AWS Lambda 如何使用python boto3将s3对象从一个存储桶复制到另一个存储桶 - how to copy s3 object from one bucket to another using python boto3 如何使用 python boto3 将文件和文件夹从一个 S3 存储桶复制到另一个 S3 - how to copy files and folders from one S3 bucket to another S3 using python boto3 如何使用Python boto3从AWS DynamoDB表中获取特定属性的所有项目? - How to fetch all items of a particular Attribute from an AWS DynamoDB Table using Python boto3? 使用 Boto3 从 DynamoDB 获取时出错 - error while fetching from DynamoDB using Boto3 在不使用 boto3 的情况下改变 DynamoDB 中的表 - Mutate table in DynamoDB without using boto3 使用 python boto3 进行 Dynamodb 查询/扫描 - Dynamodb query/scan using python boto3 Dynamodb-通过GSI使用python boto3查询 - Dynamodb - query by GSI using python boto3
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM