Adding column using CDK

By using CDK can I add a column with a default or constant value to every table?

Hi @SP271,
In the context of developing a new connector, you can definitely hardcode a constant value for a specific field on each incoming record that you read.
Could you please share what is your use case for this?

Hi @alafanechere
I want to fetch data from multiple sources and push it to same destination for analytics purposes. The problem with this is the data from different sources might get mixed up as all sources are having same table name with no column for differentiating source. So something like sourceID as a column will help in this case. That’s why using airbyte API I want to fetch multiple sources and then insert a new column for each source with a sourceID and then load it into destination.

You can overwrite the parse_response function to add that field:

class MyConnectorStream(HttpStream):
    def __init__(self, source_id):
        self.source_id = source_id

    def parse_response(self, response: requests.Response, **kwargs) -> Iterable[Mapping]:
        records = response.json()
        for record in records:
            record["sourceId"] = self.source_id
            yield record

Is there any equivalent of this if I use a java jdbc source. Or maybe as I am using a postgres source something like extending postgres source in the new java jdbc source that I created using cdc and overriding a method to add a column?

You need to check the Postgres Source code, it’s possible yes.