You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2022/09/27 15:16:00 UTC

[GitHub] [airflow] dstandish commented on a diff in pull request #26543: Added KinesisHook to kinesis.py

dstandish commented on code in PR #26543:
URL: https://github.com/apache/airflow/pull/26543#discussion_r981381897


##########
airflow/providers/amazon/aws/hooks/kinesis.py:
##########
@@ -44,3 +44,41 @@ def __init__(self, delivery_stream: str, *args, **kwargs) -> None:
     def put_records(self, records: Iterable):
         """Write batch records to Kinesis Firehose"""
         return self.get_conn().put_record_batch(DeliveryStreamName=self.delivery_stream, Records=records)
+
+
+class KinesisHook(AwsBaseHook):
+    """
+    Interact with AWS Kinesis Data Stream.
+
+    Additional arguments (such as ``aws_conn_id``) may be specified and
+    are passed down to the underlying AwsBaseHook.
+
+    :param delivery_stream: Name of the data stream
+
+    AWS Kinesis docs: https://docs.aws.amazon.com/streams/latest/dev/introduction.html
+
+    .. seealso::
+        :class:`~airflow.providers.amazon.aws.hooks.base_aws.AwsBaseHook`
+    """
+
+    def __init__(self, delivery_stream: str, *args, **kwargs) -> None:
+        self.delivery_stream = delivery_stream
+        kwargs["client_type"] = "kinesis"
+        super().__init__(*args, **kwargs)
+
+    def put_records(self, records: list[dict[str, str| bytes]]):

Review Comment:
   Yes! completely agree!  All the autocomplete, and none of the code!



-- 
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-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org