Hello community, I'm trying to make a tap for an ...
# singer-tap-development
a
Hello community, I'm trying to make a tap for an API that return an array of data like below. Assuming
payment_ref
can be a primary key and
date
can be a replication key. How can I set those fields, since they are not top-level fields? 🙏 Thank you
Copy code
{
  "user_hash_id": "01d65800989baa547fc4f258c9eec374",
  "details": {
    "type": "credit",
    "ref_hash": "0000026A0000000002650000000003BF",
    "currency": "SGD",
    "amount": "111.00",
    "date": "2023-03-08T11:23:32+08:00",
    "additional_information": {
      "charge_fee": "0.00",
      "instruction_id": "20230308ANZBSGS0XXXBRT6896591",
      "payment_ref": "CREDIT-35eac3c2-80c2-453c-4cea-9a6ddbacc4a9",
    }
  }
}
v
Have you tried anything yet? from https://sdk.meltano.com/en/latest/parent_streams.html#parent-child-streams
Copy code
class EpicsStream(GitlabStream):

    name = "epics"

    # ...

    def get_child_context(self, record: dict, context: Optional[dict]) -> dict:
        """Return a context dictionary for child streams."""
        return {
            "payment_ref": record["additional_information"]["payment_ref"],
        }
would do the trick 🤷
If you have issues maybe come back with a code sample / error and we can help! 😄