<@U04S8PLJWMT> I want to ask an AI bot about a con...
# ask-ai
z
@kapa.ai I want to ask an AI bot about a connector I’m working with, which contains a stream called
dimension_stream
. This connector is called multiple times—once for each country—through separate pipelines. However, the data returned by the stream does not include the country name it was called. Since each country has a different dimension, I need a way to tag or specify the country name so that it’s included in the fetched records. Is there a way to define the country name—either in the catalog or manifest file—so that when the catalog executes the
dimension_stream
, the country name is automatically added to each record? I’m using a low-code platform. MY stream
Copy code
query_objects_dimensions_stream:
    type: DeclarativeStream
    name: "query_objects_dimensions"
    primary_key: ""
    $parameters:
      path: "/query-objects?language=en"
    retriever:
      type: SimpleRetriever
      record_selector:
        $ref: "#/definitions/dimension_selector"
      paginator:
        type: NoPagination
      requester:
        $ref: "#/definitions/requester"
k
Yes, you can achieve this in Airbyte’s low-code connector framework by using the AddFields transformation in your stream definition. This allows you to add a static or parameterized field (such as the country name) to every record emitted by the stream. How to do it: 1. Define the country as a parameter in your manifest or catalog, so that each pipeline run can set the country value. 2. Use the AddFields transformation in your stream’s transformations section to inject the country name into each record. Example: Suppose you have a parameter called
country
available in your connector configuration or as a stream parameter. You can add the following to your stream definition:
Copy code
yaml query_objects_dimensions_stream:   type: DeclarativeStream   name: "query_objects_dimensions"   primary_key: ""   $parameters:     path: "/query-objects?language=en"     country: "{{ config['country'] }}"  # or however you pass the country   retriever:     type: SimpleRetriever     record_selector:       $ref: "#/definitions/dimension_selector"     paginator:       type: NoPagination     requester:       $ref: "#/definitions/requester"   transformations:     - type: AddFields       fields:         - path: ["country"]           value: "{{ config['country'] }}"  # or use the appropriate variable
- If you are using stream parameters, you can reference them with Jinja expressions like
{{ parameters['country'] }}
. - If the country is set in the connector config, use
{{ config['country'] }}
. Result: Every record output by this stream will have a
country
field with the value set for that pipeline run. References: This approach is documented in the Airbyte docs for [adding fields with transformations](https://docs.airbyte.com/platform/connector-development/config-based/understanding-the-yaml-file/record-selector#transformations) and for [custom parameter injection](https://docs.airbyte.com/platform/connector-development/connector-builder-ui/partitioning#custom-parameter-injection). If you need to pass the country as a stream parameter, you can use the
$parameters
field in your stream definition and reference it in the transformation as shown above. Let me know if you need a more specific example based on how you are passing the country value!
z
@kapa.ai Is there a way I can add a country by default to a catalogue, since every country has a separate catalogue, with the same stream.
Copy code
{
  "streams": [
    {
      "stream": {
        "name": "query_objects_dimensions",
        "json_schema": {},
        "supported_sync_modes": [
          "full_refresh"
        ]
      },
      "sync_mode": "full_refresh",
      "destination_sync_mode": "append",
      "primary_key": [],
      "cursor_field": []
    }
k
A message from kapa.ai
Based on the available Airbyte documentation, there is no built-in way to add a static field like a country directly in the Airbyte catalog (ConfiguredAirbyteCatalog) JSON. The catalog is used to define streams, sync modes, and schemas, but it does not support injecting additional fields into the records themselves by default. However, in Airbyte's low-code (declarative) connectors, you can achieve this by using the AddFields transformation in your stream definition within the connector manifest (YAML), not in the catalog JSON. This transformation allows you to add a static or parameterized field (such as a country) to every record output by the stream. You would set the country value as a parameter (e.g., from the config or stream parameters) and use the transformation to inject it into each record. This is the recommended approach for your use case in the low-code platform [Transformations - AddFields](https://docs.airbyte.com/platform/connector-development/config-based/understanding-the-yaml-file/record-selector#transformations). Summary: - The catalog JSON does not support adding static fields like country by default. - Use the AddFields transformation in your connector manifest to add the country field to each record. If you need an example of how to do this in the manifest, let me know!