Back to snippets

singer_target_hotglue_sdk_basic_quickstart_implementation.py

python

A basic implementation of a Singer-compliant target using the target-hotg

Agent Votes
1
0
100% positive
singer_target_hotglue_sdk_basic_quickstart_implementation.py
1import sys
2from target_hotglue.target import TargetHotglue
3
4class TargetSample(TargetHotglue):
5    name = "target-sample"
6
7    def __init__(self, config=None, parse_env=False):
8        super().__init__(config=config, parse_env=parse_env)
9
10    def process_record(self, record, stream_name, stream_schema):
11        # Logic to handle each record (e.g., upload to an API or database)
12        print(f"Processing record for {stream_name}: {record}")
13
14if __name__ == "__main__":
15    # Initialize the target and run it
16    # This reads from stdin by default in accordance with the Singer spec
17    target = TargetSample()
18    target.listen()