dondaum commented on code in PR #39654: URL: https://github.com/apache/airflow/pull/39654#discussion_r1607267994
########## airflow/providers/amazon/aws/transfers/s3_to_dynamodb.py: ########## @@ -0,0 +1,256 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +from __future__ import annotations + +from typing import TYPE_CHECKING, Any, Literal, Sequence, TypedDict + +from botocore.exceptions import ClientError, WaiterError + +from airflow.exceptions import AirflowException +from airflow.models import BaseOperator +from airflow.providers.amazon.aws.hooks.dynamodb import DynamoDBHook + +if TYPE_CHECKING: + from airflow.utils.context import Context + + +class AttributeDefinition(TypedDict): + """Attribute Definition Type.""" + + AttributeName: str + AttributeType: Literal["S", "N", "B"] + + +class KeySchema(TypedDict): + """Key Schema Type.""" + + AttributeName: str + KeyType: Literal["HASH", "RANGE"] + + +class S3ToDynamoDBOperator(BaseOperator): + """Load Data from S3 into a DynamoDB. + + Data stored in S3 can be uploaded to a new or existing DynamoDB. Supported file formats CSV, DynamoDB JSON and + Amazon ION. + + + :param s3_bucket: The S3 bucket that is imported + :param s3_key: Key prefix that imports single or multiple objects from S3 + :param dynamodb_table_name: Name of the table that shall be created + :param dynamodb_key_schema: Primary key and sort key. Each element represents one primary key + attribute. AttributeName is the name of the attribute. KeyType is the role for the attribute. Valid values + HASH or RANGE + :param dynamodb_attributes: Name of the attributes of a table. AttributeName is the name for the attribute + AttributeType is the data type for the attribute. Valid values for AttributeType are + S - attribute is of type String + N - attribute is of type Number + B - attribute is of type Binary + :param dynamodb_tmp_table_prefix: Prefix for the temporary DynamoDB table + :param delete_on_error: If set, the new DynamoDB table will be deleted in case of import errors + :param use_existing_table: Whether to import to an existing non new DynamoDB table. If set to Review Comment: I adapted the doc and explained the behavior of use_existing_table=false. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@airflow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org