version: 6.48.15 type: DeclarativeSource check: ...
# ask-ai
h
version: 6.48.15 type: DeclarativeSource check: type: CheckStream stream_names: - indicator_values definitions: streams: indicator_values: type: DeclarativeStream name: indicator_values retriever: type: SimpleRetriever decoder: type: JsonDecoder requester: $ref: "#/definitions/base_requester" path: https://****.*.gov.et/api/analytics http_method: GET request_parameters: dimension: dxaBjlxmZHXWv,pe201701;201702;201703;201704,ou:wqURG81DbhS record_selector: type: RecordSelector extractor: type: DpathExtractor field_path: [] schema_loader: type: InlineSchemaLoader schema: $ref: "#/schemas/indicator_values" base_requester: type: HttpRequester url_base: https://***.**.gov.et/api/analytics authenticator: type: BasicHttpAuthenticator password: "{{ config[\"password_2\"] }}" username: "{{ config[\"username_2\"] }}" streams: - $ref: "#/definitions/streams/indicator_values" spec: type: Spec connection_specification: type: object $schema: http://json-schema.org/draft-07/schema# required: - username_2 properties: password_2: type: string order: 1 title: Password always_show: true airbyte_secret: true username_2: type: string order: 0 title: Username additionalProperties: true metadata: assist: {} testedStreams: indicator_values: hasRecords: true streamHash: 0397c460900d04b6f2b4ea2a81674318c5f7bd14 hasResponse: true primaryKeysAreUnique: true primaryKeysArePresent: true responsesAreSuccessful: true autoImportSchema: indicator_values: false schemas: indicator_values: type: object properties: dx: type: string description: Indicator ID ou: type: string description: Org Unit ID pe: type: string description: Period (YYYYMM) value: type: string description: Indicator Value additionalProperties: true i have this yml file how can i add the partition_router
k
To add a
partition_router
to your YAML file, you need to define it under the
retriever
section of your stream. The
partition_router
allows you to iterate over partitions (such as different values for a parameter) and make separate requests for each partition value. Based on your current YAML and the Airbyte documentation, here’s how you can add a
ListPartitionRouter
to partition your requests by, for example, different organization units (
ou
) or periods (
pe
). Below is an example of how to add a
partition_router
for the
ou
field:
Copy code
yaml definitions:   streams:     indicator_values:       type: DeclarativeStream       name: indicator_values       retriever:         type: SimpleRetriever         decoder:           type: JsonDecoder         requester:           $ref: "#/definitions/base_requester"           path: https://****.***.gov.et/api/analytics           http_method: GET           request_parameters:             dimension: dx:aBjlxmZHXWv,pe:201701;201702;201703;201704,ou:wqURG81DbhS         record_selector:           type: RecordSelector           extractor:             type: DpathExtractor             field_path: []         partition_router:           type: ListPartitionRouter           cursor_field: "ou"           values:             - "wqURG81DbhS"             - "anotherOrgUnitId"           request_option:             type: RequestOption             field_name: "ou"             inject_into: "request_parameter"       schema_loader:         type: InlineSchemaLoader         schema:           $ref: "#/schemas/indicator_values"
Key points: - The
partition_router
is placed under the
retriever
section. -
type: ListPartitionRouter
is used for static lists of partition values. -
cursor_field
is the field you want to partition by (e.g.,
"ou"
). -
values
is the list of values to iterate over. -
request_option
specifies how to inject the partition value into the outgoing request. You can adjust the
cursor_field
and
values
to match the parameter you want to partition by (e.g.,
pe
for periods, or any other supported field). For more advanced partitioning (such as dynamic values from another stream), you would use a
SubstreamPartitionRouter
instead. See the documentation for more details and examples: [Retrieving Records Spread Across Partitions](https://docs.airbyte.com/platform/connector-development/config-based/understanding-the-yaml-file/partition-router) and [Partition Router Types](https://docs.airbyte.com/platform/next/connector-development/connector-builder-ui/partitioning#partition-router-types). If you need to partition by multiple fields, you can define multiple partition routers as an array, and Airbyte will perform a Cartesian product of all partitions as described in the docs. Let me know if you need an example for a different partitioning strategy!