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 error_handler: type: CompositeErrorHandler error_handlers: - type: DefaultErrorHandler max_retries: 100 request_parameters: dimension: >- dx:{{ stream_partition['dx'] }},pe:{{ stream_partition['pe'] }},ou:{{ stream_partition['ou'] }} record_selector: type: RecordSelector extractor: type: DpathExtractor field_path: [] partition_router: - type: ListPartitionRouter values: - aHQxr6jUXJ7 - ANdgaYiMciy - Bi20jqRJ4ZW - Bqq3KNXFksZ cursor_field: ou - type: ListPartitionRouter values: - uZ7W7fosr5K - W5IhTbVUNdH - aBjlxmZHXWv cursor_field: dx - type: ListPartitionRouter values: - 201601;201602;201603 - 201604;201605;201606 - 201607;201608;201609 - 201610;201611;201612 - 201701;201702;201703 - 201704;201705;201706 - 201707;201708;201709 - 201710;201711;201712 - 201801;201802;201803 - 201804;201805;201806 - 201807;201808;201809 - 201810;201811;201812 cursor_field: pe 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: d25512ba8ed6d19e56ee3c9b604b99c6bc9b47ee hasResponse: true primaryKeysAreUnique: true primaryKeysArePresent: true responsesAreSuccessful: true autoImportSchema: indicator_values: false schemas: indicator_values: type: object $schema: http://json-schema.org/draft-07/schema# properties: rows: type: array items: type: array items: type: string width: type: integer height: type: integer headers: type: array items: type: object properties: type: type: string meta: type: boolean name: type: string column: type: string hidden: type: boolean valueType: type: string additionalProperties: true metaData: type: object properties: items: type: object additionalProperties: type: object properties: name: type: string additionalProperties: true dimensions: type: object properties: dx: type: array items: type: string ou: type: array items: type: string pe: type: array items: type: string additionalProperties: true additionalProperties: true headerWidth: type: integer additionalProperties: true i have this custom builder is there any better way for the list partitioner like the pe to be programatically dynamic so that i dont have to add another year and its months?
k
Yes, there is a better way to make the
pe
(period) partition dynamic so you don't have to manually update the list each year. Instead of using a static list in the
ListPartitionRouter
, you can use a dynamic partitioning approach by leveraging the Substream Partition Router (sometimes called "Parent Stream" in the UI) if your API provides an endpoint that returns available periods, or you can allow the user to provide the list via configuration. ### Options for Dynamic Partitioning #### 1. User-Configurable Partition Values You can let the user specify the periods (
pe
) as an array input in the connector configuration. This way, you don't need to update the connector code for new years—users can simply provide the periods they want to sync. How to configure: - In the
ListPartitionRouter
for
pe
, set
values
to reference a user input, e.g.,
{{ config['periods'] }}
. - In your spec, add a property for
periods
as an array. Example:
Copy code
yaml partition_router:   - type: ListPartitionRouter     values: "{{ config['periods'] }}"     cursor_field: pe
And in your `spec`:
Copy code
yaml properties:   periods:     type: array     items:       type: string     title: Periods     description: List of periods to sync (e.g., ["201901", "201902", ...])
This approach is described in the documentation for static partitioning with user input, which allows the end user to control which partitions to fetch without code changes [Dynamic and static partitioning](https://docs.airbyte.com/platform/1.7/connector-development/connector-builder-ui/partitioning#dynamic-and-static-partitioning). #### 2. Dynamic Partitioning from API (Parent Stream) If your API provides an endpoint that lists available periods, you can configure a Parent Stream (Substream Partition Router) to fetch the list of periods dynamically. This way, the connector will always use the latest available periods from the API. - Configure a parent stream that fetches the list of periods. - Use the parent stream's output as the partition values for
pe
. This is the recommended approach for truly dynamic partitioning and is described in the documentation as the "dynamic" form of partitioning [Parent Stream](https://docs.airbyte.com/platform/1.7/connector-development/connector-builder-ui/partitioning#parent-stream). --- Summary: - For user-configurable static partitions, use a config reference in your
ListPartitionRouter
values. - For fully dynamic partitions, use a Parent Stream/Substream Partition Router if your API supports it. If your API does not provide a list of periods, the user-configurable approach is the best available option without custom code. > The knowledge sources do not mention a built-in way for the ListPartitionRouter to generate date ranges programmatically (e.g., by specifying a start and end year/month), so either user input or a dynamic parent stream is required for dynamic behavior. References: - [Dynamic and static partitioning](https://docs.airbyte.com/platform/1.7/connector-development/connector-builder-ui/partitioning#dynamic-and-static-partitioning) - [Parent Stream](https://docs.airbyte.com/platform/1.7/connector-development/connector-builder-ui/partitioning#parent-stream) - [Partition Router Types](https://docs.airbyte.com/platform/next/connector-development/connector-builder-ui/partitioning#partition-router-types)