I really want to avoid using python cdk however I ...
# ask-ai
b
I really want to avoid using python cdk however I need to create a low code connector which is capable of fetching streams from multiple base URLs where the end of the url is configurable like: https://someapi.example.com/api/v1/customer/{{id1}}/ Where it injects id1 into the URL and then then each stream has the customer as a column with the id.
k
You do not need to use the Python CDK to achieve this—Airbyte’s low-code Connector Builder UI supports your use case through Stream Templates and Jinja variable injection. How to achieve dynamic URL injection and customer ID as a column: 1. Use Stream Templates: Stream Templates allow you to generate multiple similar streams from a single template configuration. You can fetch a list of customer IDs from an endpoint, and then generate a stream for each customer, dynamically injecting the ID into the URL path. 2. Injecting IDs into the URL: In the Generated Stream Template section, you can use Jinja expressions like
{{ components_values.id1 }}
to inject the customer ID into the URL path, e.g.
/api/v1/customer/{{ components_values.id1 }}/
. 3. Including the customer ID as a column: The value used for the URL (e.g.,
id1
) can also be included as a field in each record by referencing it in your stream configuration. Example setup: - Fetch Data for Template: Set up an endpoint (e.g.,
/customers
) that returns a list of customer IDs. - Generated Stream Template: - Name:
Customer {{ components_values.id1 }}
- URL Path:
/api/v1/customer/{{ components_values.id1 }}/
- The
id1
value will be available for use in the stream and can be included as a column in your schema. References: This approach is described in the Stream Templates documentation, which shows how to use values from a fetched list to generate streams and inject those values into the URL path using Jinja expressions. The same mechanism allows you to include those values as columns in your output records. For more details and a step-by-step example, see the [Stream Templates documentation](https://docs.airbyte.com/platform/connector-development/connector-builder-ui/stream-templates). If your API requires even more custom parameter injection (e.g., complex URL or parameter logic), you can use the generic parameter section with Jinja expressions as described in the [custom parameter injection documentation](https://docs.airbyte.com/platform/connector-development/connector-builder-ui/partitioning#custom-parameter-injection). Summary: You can accomplish your goal entirely within the low-code Connector Builder UI, using Stream Templates and Jinja variable injection—no Python CDK required.
b
Ok if the destination is a postgres destination will the streams go into a seperate tables for each stream? @kapa.ai. Right now I have a single base url with e.g. “protocols”, “molecules”, “results”. What if I need it to fetch each of those for multiple different customer ids?
k
A message from kapa.ai
Yes, when using the Postgres destination in Airbyte, each stream will be written to a separate table in your Postgres database. This is the default behavior: every stream you define (for example, one per customer per resource like
protocols
,
molecules
,
results
) will result in a separate table in the destination schema. The table names will match the stream names, possibly with a prefix or namespace if you configure those options. You cannot natively merge multiple streams into a single table within Airbyte itself; each stream is mapped to its own table in Postgres [see documentation](https://docs.airbyte.com/integrations/destinations/postgres#schema-map). If you use Stream Templates to generate streams for each combination of customer ID and resource (e.g.,
customer1_protocols
,
customer2_protocols
, etc.), each of these will become a separate table in Postgres. There is currently no built-in way in Airbyte to combine multiple streams into a single destination table (for example, to have all customer protocols in one
protocols
table with a
customer_id
column). This limitation is confirmed in both the documentation and community discussions [see here](https://github.com/airbytehq/airbyte/issues/2224) and [here](https://discuss.airbyte.io/t/2728). Summary: - Each stream = separate table in Postgres. - If you want to fetch
protocols
,
molecules
,
results
for multiple customer IDs, and you use stream templates, you will get a separate table for each combination. - If you want all data in a single table, you must combine the tables downstream of Airbyte, after sync [see documentation](https://docs.airbyte.com/platform/using-airbyte/configuring-schema). If you need to merge data from multiple streams into a single table, you will need to do this outside of Airbyte, for example using SQL or dbt after the sync is complete.
b
Can I have all of them go to a single table? e.g. “protocols” with a column “customer” with the correct id in the column? @kapa.ai
k
A message from kapa.ai
No, Airbyte does not currently support merging multiple source streams into a single destination table with an additional column (such as "customer") directly within the platform. Each stream is written to a separate table in the Postgres destination by default. This limitation is confirmed in both the documentation and community discussions. If you want all data in a single table with a "customer" column, you will need to combine the tables downstream of Airbyte, for example using SQL or dbt after the sync is complete [see discussion](https://github.com/airbytehq/airbyte/issues/2224) [see docs](https://docs.airbyte.com/platform/using-airbyte/configuring-schema). > "Airbyte does not allow for the renaming of individual streams at this time... If you want to sync your data into a single table, combine it downstream, in your destination, after Airbyte has synced it." [Configuring Schemas](https://docs.airbyte.com/platform/using-airbyte/configuring-schema) This is a known feature request and is not natively supported as of now.
b
@kapa.ai Can you tell me why partitions aren’t a good choice for this scenario?
k
A message from kapa.ai
Partitions in Airbyte are not a good choice for merging multiple logical streams (such as different customer data) into a single destination table with a "customer" column, because partitioning in Airbyte is designed for a different purpose. Partitioning is intended for scenarios where: - An API requires different parameter values (like IDs or categories) to access different subsets of the same logical data stream. - You need to make multiple requests to fetch all records for a single stream, such as fetching data for each customer by injecting their ID into the API request. Partitioning is NOT intended for: - Merging multiple logical streams into a single table in the destination. - Combining data from different sources or customers into one table with an extra column indicating the source. As stated in the documentation: > Partitioning is specifically for cases where the API requires different parameter values to access different subsets of the same logical data stream. [Partitioning - When not to Use Partitioning](https://docs.airbyte.com/platform/next/connector-development/connector-builder-ui/partitioning#when-not-to-use-partitioning) If your goal is to have all customer data in a single table with a "customer" column, partitioning will not achieve this. Instead, partitioning will help you fetch the data, but Airbyte will still write each stream to a separate table in the destination. You would need to combine the tables downstream after the sync is complete. Summary: Partitioning is for fetching subsets of a single stream, not for merging multiple streams into one table with an extra column. For your use case, you will need to combine the data after Airbyte syncs it to your destination.
b
@kapa.ai Why use stream templates over partitions though?
k
A message from kapa.ai
New message text here