Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into baz/cdk/test-read-ref…
Browse files Browse the repository at this point in the history
…actor
  • Loading branch information
bazarnov committed Feb 12, 2025
2 parents 9acb9a3 + fdcded3 commit 2dce6ff
Show file tree
Hide file tree
Showing 17 changed files with 1,012 additions and 375 deletions.
270 changes: 189 additions & 81 deletions airbyte_cdk/sources/declarative/declarative_component_schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ properties:
"$ref": "#/definitions/Spec"
concurrency_level:
"$ref": "#/definitions/ConcurrencyLevel"
api_budget:
"$ref": "#/definitions/HTTPAPIBudget"
metadata:
type: object
description: For internal Airbyte use only - DO NOT modify manually. Used by consumers of declarative manifests for storing related metadata.
Expand Down Expand Up @@ -794,7 +796,7 @@ definitions:
description: This option is used to adjust the upper and lower boundaries of each datetime window to beginning and end of the provided target period (day, week, month)
type: object
required:
- target
- target
properties:
target:
title: Target
Expand Down Expand Up @@ -1365,6 +1367,170 @@ definitions:
$parameters:
type: object
additional_properties: true
HTTPAPIBudget:
title: HTTP API Budget
description: >
Defines how many requests can be made to the API in a given time frame. `HTTPAPIBudget` extracts the remaining
call count and the reset time from HTTP response headers using the header names provided by
`ratelimit_remaining_header` and `ratelimit_reset_header`. Only requests using `HttpRequester`
are rate-limited; custom components that bypass `HttpRequester` are not covered by this budget.
type: object
required:
- type
- policies
properties:
type:
type: string
enum: [HTTPAPIBudget]
policies:
title: Policies
description: List of call rate policies that define how many calls are allowed.
type: array
items:
anyOf:
- "$ref": "#/definitions/FixedWindowCallRatePolicy"
- "$ref": "#/definitions/MovingWindowCallRatePolicy"
- "$ref": "#/definitions/UnlimitedCallRatePolicy"
ratelimit_reset_header:
title: Rate Limit Reset Header
description: The HTTP response header name that indicates when the rate limit resets.
type: string
default: "ratelimit-reset"
ratelimit_remaining_header:
title: Rate Limit Remaining Header
description: The HTTP response header name that indicates the number of remaining allowed calls.
type: string
default: "ratelimit-remaining"
status_codes_for_ratelimit_hit:
title: Status Codes for Rate Limit Hit
description: List of HTTP status codes that indicate a rate limit has been hit.
type: array
items:
type: integer
default: [429]
additionalProperties: true
FixedWindowCallRatePolicy:
title: Fixed Window Call Rate Policy
description: A policy that allows a fixed number of calls within a specific time window.
type: object
required:
- type
- period
- call_limit
- matchers
properties:
type:
type: string
enum: [FixedWindowCallRatePolicy]
period:
title: Period
description: The time interval for the rate limit window.
type: string
call_limit:
title: Call Limit
description: The maximum number of calls allowed within the period.
type: integer
matchers:
title: Matchers
description: List of matchers that define which requests this policy applies to.
type: array
items:
"$ref": "#/definitions/HttpRequestRegexMatcher"
additionalProperties: true
MovingWindowCallRatePolicy:
title: Moving Window Call Rate Policy
description: A policy that allows a fixed number of calls within a moving time window.
type: object
required:
- type
- rates
- matchers
properties:
type:
type: string
enum: [MovingWindowCallRatePolicy]
rates:
title: Rates
description: List of rates that define the call limits for different time intervals.
type: array
items:
"$ref": "#/definitions/Rate"
matchers:
title: Matchers
description: List of matchers that define which requests this policy applies to.
type: array
items:
"$ref": "#/definitions/HttpRequestRegexMatcher"
additionalProperties: true
UnlimitedCallRatePolicy:
title: Unlimited Call Rate Policy
description: A policy that allows unlimited calls for specific requests.
type: object
required:
- type
- matchers
properties:
type:
type: string
enum: [UnlimitedCallRatePolicy]
matchers:
title: Matchers
description: List of matchers that define which requests this policy applies to.
type: array
items:
"$ref": "#/definitions/HttpRequestRegexMatcher"
additionalProperties: true
Rate:
title: Rate
description: Defines a rate limit with a specific number of calls allowed within a time interval.
type: object
required:
- limit
- interval
properties:
limit:
title: Limit
description: The maximum number of calls allowed within the interval.
type: integer
interval:
title: Interval
description: The time interval for the rate limit.
type: string
examples:
- "PT1H"
- "P1D"
additionalProperties: true
HttpRequestRegexMatcher:
title: HTTP Request Matcher
description: >
Matches HTTP requests based on method, base URL, URL path pattern, query parameters, and headers.
Use `url_base` to specify the scheme and host (without trailing slash) and
`url_path_pattern` to apply a regex to the request path.
type: object
properties:
method:
title: Method
description: The HTTP method to match (e.g., GET, POST).
type: string
url_base:
title: URL Base
description: The base URL (scheme and host, e.g. "https://api.example.com") to match.
type: string
url_path_pattern:
title: URL Path Pattern
description: A regular expression pattern to match the URL path.
type: string
params:
title: Parameters
description: The query parameters to match.
type: object
additionalProperties: true
headers:
title: Headers
description: The headers to match.
type: object
additionalProperties: true
additionalProperties: true
DefaultErrorHandler:
title: Default Error Handler
description: Component defining how to handle errors. Default behavior includes only retrying server errors (HTTP 5XX) and too many requests (HTTP 429) with an exponential backoff.
Expand Down Expand Up @@ -1549,7 +1715,6 @@ definitions:
anyOf:
- "$ref": "#/definitions/JsonDecoder"
- "$ref": "#/definitions/XmlDecoder"
- "$ref": "#/definitions/CompositeRawDecoder"
$parameters:
type: object
additionalProperties: true
Expand Down Expand Up @@ -2133,43 +2298,26 @@ definitions:
$parameters:
type: object
additionalProperties: true
GzipJsonDecoder:
title: GzipJson Decoder
description: Use this if the response is Gzip compressed Json.
type: object
additionalProperties: true
required:
- type
properties:
type:
type: string
enum: [GzipJsonDecoder]
encoding:
type: string
default: utf-8
$parameters:
type: object
additionalProperties: true
ZipfileDecoder:
title: Zipfile Decoder
description: Decoder for response data that is returned as zipfile(s).
type: object
additionalProperties: true
required:
- type
- parser
- decoder
properties:
type:
type: string
enum: [ZipfileDecoder]
parser:
decoder:
title: Parser
description: Parser to parse the decompressed data from the zipfile(s).
anyOf:
- "$ref": "#/definitions/GzipParser"
- "$ref": "#/definitions/JsonParser"
- "$ref": "#/definitions/JsonLineParser"
- "$ref": "#/definitions/CsvParser"
- "$ref": "#/definitions/CsvDecoder"
- "$ref": "#/definitions/GzipDecoder"
- "$ref": "#/definitions/JsonDecoder"
- "$ref": "#/definitions/JsonlDecoder"
ListPartitionRouter:
title: List Partition Router
description: A Partition router that specifies a list of attributes where each attribute describes a portion of the complete data set for a stream. During a sync, each value is iterated over and can be used as input to outbound API requests.
Expand Down Expand Up @@ -3002,79 +3150,39 @@ definitions:
description: Component decoding the response so records can be extracted.
anyOf:
- "$ref": "#/definitions/CustomDecoder"
- "$ref": "#/definitions/CsvDecoder"
- "$ref": "#/definitions/GzipDecoder"
- "$ref": "#/definitions/JsonDecoder"
- "$ref": "#/definitions/JsonlDecoder"
- "$ref": "#/definitions/IterableDecoder"
- "$ref": "#/definitions/XmlDecoder"
- "$ref": "#/definitions/GzipJsonDecoder"
- "$ref": "#/definitions/CompositeRawDecoder"
- "$ref": "#/definitions/ZipfileDecoder"
$parameters:
type: object
additionalProperties: true
CompositeRawDecoder:
description: "(This is experimental, use at your own risk)"
type: object
required:
- type
- parser
properties:
type:
type: string
enum: [CompositeRawDecoder]
parser:
anyOf:
- "$ref": "#/definitions/GzipParser"
- "$ref": "#/definitions/JsonParser"
- "$ref": "#/definitions/JsonLineParser"
- "$ref": "#/definitions/CsvParser"
# PARSERS
GzipParser:
GzipDecoder:
type: object
required:
- type
- inner_parser
- decoder
properties:
type:
type: string
enum: [GzipParser]
inner_parser:
enum: [GzipDecoder]
decoder:
anyOf:
- "$ref": "#/definitions/JsonLineParser"
- "$ref": "#/definitions/CsvParser"
- "$ref": "#/definitions/JsonParser"
JsonParser:
title: JsonParser
description: Parser used for parsing str, bytes, or bytearray data and returning data in a dictionary format.
type: object
required:
- type
properties:
type:
type: string
enum: [JsonParser]
encoding:
type: string
default: utf-8
JsonLineParser:
type: object
required:
- type
properties:
type:
type: string
enum: [JsonLineParser]
encoding:
type: string
default: utf-8
CsvParser:
- "$ref": "#/definitions/CsvDecoder"
- "$ref": "#/definitions/GzipDecoder"
- "$ref": "#/definitions/JsonDecoder"
- "$ref": "#/definitions/JsonlDecoder"
CsvDecoder:
type: object
required:
- type
properties:
type:
type: string
enum: [CsvParser]
enum: [CsvDecoder]
encoding:
type: string
default: utf-8
Expand Down Expand Up @@ -3202,24 +3310,24 @@ definitions:
description: Component decoding the response so records can be extracted.
anyOf:
- "$ref": "#/definitions/CustomDecoder"
- "$ref": "#/definitions/CsvDecoder"
- "$ref": "#/definitions/GzipDecoder"
- "$ref": "#/definitions/JsonDecoder"
- "$ref": "#/definitions/JsonlDecoder"
- "$ref": "#/definitions/IterableDecoder"
- "$ref": "#/definitions/XmlDecoder"
- "$ref": "#/definitions/GzipJsonDecoder"
- "$ref": "#/definitions/CompositeRawDecoder"
- "$ref": "#/definitions/ZipfileDecoder"
download_decoder:
title: Download Decoder
description: Component decoding the download response so records can be extracted.
anyOf:
- "$ref": "#/definitions/CustomDecoder"
- "$ref": "#/definitions/CsvDecoder"
- "$ref": "#/definitions/GzipDecoder"
- "$ref": "#/definitions/JsonDecoder"
- "$ref": "#/definitions/JsonlDecoder"
- "$ref": "#/definitions/IterableDecoder"
- "$ref": "#/definitions/XmlDecoder"
- "$ref": "#/definitions/GzipJsonDecoder"
- "$ref": "#/definitions/CompositeRawDecoder"
- "$ref": "#/definitions/ZipfileDecoder"
$parameters:
type: object
Expand Down
4 changes: 0 additions & 4 deletions airbyte_cdk/sources/declarative/decoders/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,8 @@
)
from airbyte_cdk.sources.declarative.decoders.decoder import Decoder
from airbyte_cdk.sources.declarative.decoders.json_decoder import (
GzipJsonDecoder,
IterableDecoder,
JsonDecoder,
JsonlDecoder,
)
from airbyte_cdk.sources.declarative.decoders.noop_decoder import NoopDecoder
from airbyte_cdk.sources.declarative.decoders.pagination_decoder_decorator import (
Expand All @@ -27,9 +25,7 @@
"CompositeRawDecoder",
"JsonDecoder",
"JsonParser",
"JsonlDecoder",
"IterableDecoder",
"GzipJsonDecoder",
"NoopDecoder",
"PaginationDecoderDecorator",
"XmlDecoder",
Expand Down
Loading

0 comments on commit 2dce6ff

Please sign in to comment.