sdk icon indicating copy to clipboard operation
sdk copied to clipboard

[Bug]: `batch_id` is not set in Sink context when processing batch messages

Open edgarrmondragon opened this issue 3 years ago • 3 comments

Singer SDK Version

0.11.1

Python Version

NA

Bug scope

Targets (data type handling, batching, SQL object generation, etc.)

Operating System

Any

Description

Target._process_record_message initializes the target context by calling Sink._get_context, which in the BatchSink implementation sets the batch_id key to a UUID string. Target._process_batch_message should behave in a similar way.

https://github.com/meltano/sdk/blob/5f9f70a99c6314d87ad91b7a2ad3ef7886483d6f/singer_sdk/target_base.py#L281-L318

Code

No response

edgarrmondragon avatar Oct 03 '22 16:10 edgarrmondragon

Also note the follow

def tally_record_written(self, count: int = 1) -> None:
        """Increment the records written tally.

        This method is called automatically by the SDK after
        :meth:`~singer_sdk.Sink.process_record()`
        or :meth:`~singer_sdk.Sink.process_batch()`.

But this method is never called after processing a batch message. So mark_drained should also be called once the batch message has been processed.

spacecowboy avatar Oct 03 '22 19:10 spacecowboy

This has been marked as stale because it is unassigned, and has not had recent activity. It will be closed after 21 days if no further activity occurs. If this should never go stale, please add the evergreen label, or request that it be added.

stale[bot] avatar Jul 18 '23 05:07 stale[bot]

This has been marked as stale because it is unassigned, and has not had recent activity. It will be closed after 21 days if no further activity occurs. If this should never go stale, please add the evergreen label, or request that it be added.

stale[bot] avatar Jul 18 '24 03:07 stale[bot]

This has been marked as stale because it is unassigned, and has not had recent activity. It will be closed after 21 days if no further activity occurs. If this should never go stale, please add the evergreen label, or request that it be added.

stale[bot] avatar Oct 02 '25 19:10 stale[bot]