airbyte-cdk 6.12.1__py3-none-any.whl → 6.12.1.dev0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- airbyte_cdk/sources/declarative/declarative_component_schema.yaml +35 -73
- airbyte_cdk/sources/declarative/models/declarative_component_schema.py +44 -65
- airbyte_cdk/sources/declarative/parsers/model_to_component_factory.py +6 -47
- airbyte_cdk/sources/declarative/partition_routers/__init__.py +1 -9
- airbyte_cdk/sources/declarative/retrievers/async_retriever.py +31 -8
- airbyte_cdk/sources/declarative/schema/dynamic_schema_loader.py +3 -20
- airbyte_cdk/sources/streams/core.py +6 -6
- airbyte_cdk/sources/streams/http/http_client.py +2 -4
- {airbyte_cdk-6.12.1.dist-info → airbyte_cdk-6.12.1.dev0.dist-info}/METADATA +1 -2
- {airbyte_cdk-6.12.1.dist-info → airbyte_cdk-6.12.1.dev0.dist-info}/RECORD +13 -16
- airbyte_cdk/sources/declarative/partition_routers/async_job_partition_router.py +0 -65
- airbyte_cdk/sources/declarative/transformations/flatten_fields.py +0 -50
- airbyte_cdk/sources/declarative/transformations/keys_to_snake_transformation.py +0 -68
- {airbyte_cdk-6.12.1.dist-info → airbyte_cdk-6.12.1.dev0.dist-info}/LICENSE.txt +0 -0
- {airbyte_cdk-6.12.1.dist-info → airbyte_cdk-6.12.1.dev0.dist-info}/WHEEL +0 -0
- {airbyte_cdk-6.12.1.dist-info → airbyte_cdk-6.12.1.dev0.dist-info}/entry_points.txt +0 -0
@@ -1234,8 +1234,6 @@ definitions:
|
|
1234
1234
|
- "$ref": "#/definitions/CustomTransformation"
|
1235
1235
|
- "$ref": "#/definitions/RemoveFields"
|
1236
1236
|
- "$ref": "#/definitions/KeysToLower"
|
1237
|
-
- "$ref": "#/definitions/KeysToSnakeCase"
|
1238
|
-
- "$ref": "#/definitions/FlattenFields"
|
1239
1237
|
state_migrations:
|
1240
1238
|
title: State Migrations
|
1241
1239
|
description: Array of state migrations to be applied on the input state
|
@@ -1768,18 +1766,6 @@ definitions:
|
|
1768
1766
|
- "$ref": "#/definitions/AsyncRetriever"
|
1769
1767
|
- "$ref": "#/definitions/CustomRetriever"
|
1770
1768
|
- "$ref": "#/definitions/SimpleRetriever"
|
1771
|
-
schema_transformations:
|
1772
|
-
title: Schema Transformations
|
1773
|
-
description: A list of transformations to be applied to the schema.
|
1774
|
-
type: array
|
1775
|
-
items:
|
1776
|
-
anyOf:
|
1777
|
-
- "$ref": "#/definitions/AddFields"
|
1778
|
-
- "$ref": "#/definitions/CustomTransformation"
|
1779
|
-
- "$ref": "#/definitions/RemoveFields"
|
1780
|
-
- "$ref": "#/definitions/KeysToLower"
|
1781
|
-
- "$ref": "#/definitions/KeysToSnakeCase"
|
1782
|
-
- "$ref": "#/definitions/FlattenFields"
|
1783
1769
|
schema_type_identifier:
|
1784
1770
|
"$ref": "#/definitions/SchemaTypeIdentifier"
|
1785
1771
|
$parameters:
|
@@ -1852,32 +1838,6 @@ definitions:
|
|
1852
1838
|
$parameters:
|
1853
1839
|
type: object
|
1854
1840
|
additionalProperties: true
|
1855
|
-
KeysToSnakeCase:
|
1856
|
-
title: Key to Snake Case
|
1857
|
-
description: A transformation that renames all keys to snake case.
|
1858
|
-
type: object
|
1859
|
-
required:
|
1860
|
-
- type
|
1861
|
-
properties:
|
1862
|
-
type:
|
1863
|
-
type: string
|
1864
|
-
enum: [KeysToSnakeCase]
|
1865
|
-
$parameters:
|
1866
|
-
type: object
|
1867
|
-
additionalProperties: true
|
1868
|
-
FlattenFields:
|
1869
|
-
title: Flatten Fields
|
1870
|
-
description: A transformation that flatten record to single level format.
|
1871
|
-
type: object
|
1872
|
-
required:
|
1873
|
-
- type
|
1874
|
-
properties:
|
1875
|
-
type:
|
1876
|
-
type: string
|
1877
|
-
enum: [FlattenFields]
|
1878
|
-
$parameters:
|
1879
|
-
type: object
|
1880
|
-
additionalProperties: true
|
1881
1841
|
IterableDecoder:
|
1882
1842
|
title: Iterable Decoder
|
1883
1843
|
description: Use this if the response consists of strings separated by new lines (`\n`). The Decoder will wrap each row into a JSON object with the `record` key.
|
@@ -2170,63 +2130,65 @@ definitions:
|
|
2170
2130
|
- extract_output
|
2171
2131
|
properties:
|
2172
2132
|
consent_url:
|
2173
|
-
title: Consent URL
|
2133
|
+
title: DeclarativeOAuth Consent URL
|
2174
2134
|
type: string
|
2175
2135
|
description: |-
|
2176
2136
|
The DeclarativeOAuth Specific string URL string template to initiate the authentication.
|
2177
2137
|
The placeholders are replaced during the processing to provide neccessary values.
|
2178
2138
|
examples:
|
2179
|
-
- https://domain.host.com/marketing_api/auth?{client_id_key}={{client_id_key}}&{redirect_uri_key}={urlEncoder:{{redirect_uri_key}}}&{state_key}={{state_key}}
|
2180
|
-
- https://endpoint.host.com/oauth2/authorize?{client_id_key}={{client_id_key}}&{redirect_uri_key}={urlEncoder:{{redirect_uri_key}}}&{scope_key}={urlEncoder:{{scope_key}}}&{state_key}={{state_key}}&subdomain={subdomain}
|
2139
|
+
- consent_url: https://domain.host.com/marketing_api/auth?{client_id_key}={{client_id_key}}&{redirect_uri_key}={urlEncoder:{{redirect_uri_key}}}&{state_key}={{state_key}}
|
2140
|
+
- consent_url: https://endpoint.host.com/oauth2/authorize?{client_id_key}={{client_id_key}}&{redirect_uri_key}={urlEncoder:{{redirect_uri_key}}}&{scope_key}={urlEncoder:{{scope_key}}}&{state_key}={{state_key}}&subdomain={subdomain}
|
2181
2141
|
scope:
|
2182
|
-
title:
|
2142
|
+
title: (Optional) DeclarativeOAuth Scope
|
2183
2143
|
type: string
|
2184
2144
|
description: |-
|
2185
2145
|
The DeclarativeOAuth Specific string of the scopes needed to be grant for authenticated user.
|
2186
2146
|
examples:
|
2187
|
-
- user:read user:read_orders workspaces:read
|
2147
|
+
- scope: user:read user:read_orders workspaces:read
|
2188
2148
|
access_token_url:
|
2189
|
-
title: Access Token URL
|
2149
|
+
title: DeclarativeOAuth Access Token URL
|
2190
2150
|
type: string
|
2191
2151
|
description: |-
|
2192
2152
|
The DeclarativeOAuth Specific URL templated string to obtain the `access_token`, `refresh_token` etc.
|
2193
2153
|
The placeholders are replaced during the processing to provide neccessary values.
|
2194
2154
|
examples:
|
2195
|
-
- https://auth.host.com/oauth2/token?{client_id_key}={{client_id_key}}&{client_secret_key}={{client_secret_key}}&{auth_code_key}={{auth_code_key}}&{redirect_uri_key}={urlEncoder:{{redirect_uri_key}}}
|
2155
|
+
- access_token_url: https://auth.host.com/oauth2/token?{client_id_key}={{client_id_key}}&{client_secret_key}={{client_secret_key}}&{auth_code_key}={{auth_code_key}}&{redirect_uri_key}={urlEncoder:{{redirect_uri_key}}}
|
2196
2156
|
access_token_headers:
|
2197
|
-
title: Access Token Headers
|
2157
|
+
title: (Optional) DeclarativeOAuth Access Token Headers
|
2198
2158
|
type: object
|
2199
2159
|
additionalProperties: true
|
2200
2160
|
description: |-
|
2201
2161
|
The DeclarativeOAuth Specific optional headers to inject while exchanging the `auth_code` to `access_token` during `completeOAuthFlow` step.
|
2202
2162
|
examples:
|
2203
|
-
-
|
2204
|
-
|
2205
|
-
|
2163
|
+
- access_token_headers:
|
2164
|
+
{
|
2165
|
+
"Authorization": "Basic {base64Encoder:{client_id}:{client_secret}}",
|
2166
|
+
}
|
2206
2167
|
access_token_params:
|
2207
|
-
title: Access Token Query Params (Json Encoded)
|
2168
|
+
title: (Optional) DeclarativeOAuth Access Token Query Params (Json Encoded)
|
2208
2169
|
type: object
|
2209
2170
|
additionalProperties: true
|
2210
2171
|
description: |-
|
2211
2172
|
The DeclarativeOAuth Specific optional query parameters to inject while exchanging the `auth_code` to `access_token` during `completeOAuthFlow` step.
|
2212
2173
|
When this property is provided, the query params will be encoded as `Json` and included in the outgoing API request.
|
2213
2174
|
examples:
|
2214
|
-
-
|
2215
|
-
|
2216
|
-
|
2217
|
-
|
2218
|
-
|
2175
|
+
- access_token_params:
|
2176
|
+
{
|
2177
|
+
"{auth_code_key}": "{{auth_code_key}}",
|
2178
|
+
"{client_id_key}": "{{client_id_key}}",
|
2179
|
+
"{client_secret_key}": "{{client_secret_key}}",
|
2180
|
+
}
|
2219
2181
|
extract_output:
|
2220
|
-
title: Extract Output
|
2182
|
+
title: DeclarativeOAuth Extract Output
|
2221
2183
|
type: array
|
2222
2184
|
items:
|
2223
2185
|
type: string
|
2224
2186
|
description: |-
|
2225
2187
|
The DeclarativeOAuth Specific list of strings to indicate which keys should be extracted and returned back to the input config.
|
2226
2188
|
examples:
|
2227
|
-
- ["access_token", "refresh_token", "other_field"]
|
2189
|
+
- extract_output: ["access_token", "refresh_token", "other_field"]
|
2228
2190
|
state:
|
2229
|
-
title: Configurable State Query Param
|
2191
|
+
title: (Optional) DeclarativeOAuth Configurable State Query Param
|
2230
2192
|
type: object
|
2231
2193
|
additionalProperties: true
|
2232
2194
|
required:
|
@@ -2241,49 +2203,49 @@ definitions:
|
|
2241
2203
|
max:
|
2242
2204
|
type: integer
|
2243
2205
|
examples:
|
2244
|
-
- { "min": 7, "max": 128 }
|
2206
|
+
- state: { "min": 7, "max": 128 }
|
2245
2207
|
client_id_key:
|
2246
|
-
title: Client ID Key Override
|
2208
|
+
title: (Optional) DeclarativeOAuth Client ID Key Override
|
2247
2209
|
type: string
|
2248
2210
|
description: |-
|
2249
2211
|
The DeclarativeOAuth Specific optional override to provide the custom `client_id` key name, if required by data-provider.
|
2250
2212
|
examples:
|
2251
|
-
- "my_custom_client_id_key_name"
|
2213
|
+
- client_id_key: "my_custom_client_id_key_name"
|
2252
2214
|
client_secret_key:
|
2253
|
-
title: Client Secret Key Override
|
2215
|
+
title: (Optional) DeclarativeOAuth Client Secret Key Override
|
2254
2216
|
type: string
|
2255
2217
|
description: |-
|
2256
2218
|
The DeclarativeOAuth Specific optional override to provide the custom `client_secret` key name, if required by data-provider.
|
2257
2219
|
examples:
|
2258
|
-
- "my_custom_client_secret_key_name"
|
2220
|
+
- client_secret_key: "my_custom_client_secret_key_name"
|
2259
2221
|
scope_key:
|
2260
|
-
title:
|
2222
|
+
title: (Optional) DeclarativeOAuth Scope Key Override
|
2261
2223
|
type: string
|
2262
2224
|
description: |-
|
2263
2225
|
The DeclarativeOAuth Specific optional override to provide the custom `scope` key name, if required by data-provider.
|
2264
2226
|
examples:
|
2265
|
-
- "my_custom_scope_key_key_name"
|
2227
|
+
- scope_key: "my_custom_scope_key_key_name"
|
2266
2228
|
state_key:
|
2267
|
-
title: State Key Override
|
2229
|
+
title: (Optional) DeclarativeOAuth State Key Override
|
2268
2230
|
type: string
|
2269
2231
|
description: |-
|
2270
2232
|
The DeclarativeOAuth Specific optional override to provide the custom `state` key name, if required by data-provider.
|
2271
2233
|
examples:
|
2272
|
-
- "my_custom_state_key_key_name"
|
2234
|
+
- state_key: "my_custom_state_key_key_name"
|
2273
2235
|
auth_code_key:
|
2274
|
-
title: Auth Code Key Override
|
2236
|
+
title: (Optional) DeclarativeOAuth Auth Code Key Override
|
2275
2237
|
type: string
|
2276
2238
|
description: |-
|
2277
2239
|
The DeclarativeOAuth Specific optional override to provide the custom `code` key name to something like `auth_code` or `custom_auth_code`, if required by data-provider.
|
2278
2240
|
examples:
|
2279
|
-
- "my_custom_auth_code_key_name"
|
2241
|
+
- auth_code_key: "my_custom_auth_code_key_name"
|
2280
2242
|
redirect_uri_key:
|
2281
|
-
title: Redirect URI Key Override
|
2243
|
+
title: (Optional) DeclarativeOAuth Redirect URI Key Override
|
2282
2244
|
type: string
|
2283
2245
|
description: |-
|
2284
2246
|
The DeclarativeOAuth Specific optional override to provide the custom `redirect_uri` key name to something like `callback_uri`, if required by data-provider.
|
2285
2247
|
examples:
|
2286
|
-
- "my_custom_redirect_uri_key_name"
|
2248
|
+
- redirect_uri_key: "my_custom_redirect_uri_key_name"
|
2287
2249
|
complete_oauth_output_specification:
|
2288
2250
|
title: "OAuth output specification"
|
2289
2251
|
description: |-
|
@@ -710,16 +710,6 @@ class KeysToLower(BaseModel):
|
|
710
710
|
parameters: Optional[Dict[str, Any]] = Field(None, alias="$parameters")
|
711
711
|
|
712
712
|
|
713
|
-
class KeysToSnakeCase(BaseModel):
|
714
|
-
type: Literal["KeysToSnakeCase"]
|
715
|
-
parameters: Optional[Dict[str, Any]] = Field(None, alias="$parameters")
|
716
|
-
|
717
|
-
|
718
|
-
class FlattenFields(BaseModel):
|
719
|
-
type: Literal["FlattenFields"]
|
720
|
-
parameters: Optional[Dict[str, Any]] = Field(None, alias="$parameters")
|
721
|
-
|
722
|
-
|
723
713
|
class IterableDecoder(BaseModel):
|
724
714
|
type: Literal["IterableDecoder"]
|
725
715
|
|
@@ -805,90 +795,104 @@ class OauthConnectorInputSpecification(BaseModel):
|
|
805
795
|
...,
|
806
796
|
description="The DeclarativeOAuth Specific string URL string template to initiate the authentication.\nThe placeholders are replaced during the processing to provide neccessary values.",
|
807
797
|
examples=[
|
808
|
-
|
809
|
-
|
798
|
+
{
|
799
|
+
"consent_url": "https://domain.host.com/marketing_api/auth?{client_id_key}={{client_id_key}}&{redirect_uri_key}={urlEncoder:{{redirect_uri_key}}}&{state_key}={{state_key}}"
|
800
|
+
},
|
801
|
+
{
|
802
|
+
"consent_url": "https://endpoint.host.com/oauth2/authorize?{client_id_key}={{client_id_key}}&{redirect_uri_key}={urlEncoder:{{redirect_uri_key}}}&{scope_key}={urlEncoder:{{scope_key}}}&{state_key}={{state_key}}&subdomain={subdomain}"
|
803
|
+
},
|
810
804
|
],
|
811
|
-
title="Consent URL",
|
805
|
+
title="DeclarativeOAuth Consent URL",
|
812
806
|
)
|
813
807
|
scope: Optional[str] = Field(
|
814
808
|
None,
|
815
809
|
description="The DeclarativeOAuth Specific string of the scopes needed to be grant for authenticated user.",
|
816
|
-
examples=["user:read user:read_orders workspaces:read"],
|
817
|
-
title="
|
810
|
+
examples=[{"scope": "user:read user:read_orders workspaces:read"}],
|
811
|
+
title="(Optional) DeclarativeOAuth Scope",
|
818
812
|
)
|
819
813
|
access_token_url: str = Field(
|
820
814
|
...,
|
821
815
|
description="The DeclarativeOAuth Specific URL templated string to obtain the `access_token`, `refresh_token` etc.\nThe placeholders are replaced during the processing to provide neccessary values.",
|
822
816
|
examples=[
|
823
|
-
|
817
|
+
{
|
818
|
+
"access_token_url": "https://auth.host.com/oauth2/token?{client_id_key}={{client_id_key}}&{client_secret_key}={{client_secret_key}}&{auth_code_key}={{auth_code_key}}&{redirect_uri_key}={urlEncoder:{{redirect_uri_key}}}"
|
819
|
+
}
|
824
820
|
],
|
825
|
-
title="Access Token URL",
|
821
|
+
title="DeclarativeOAuth Access Token URL",
|
826
822
|
)
|
827
823
|
access_token_headers: Optional[Dict[str, Any]] = Field(
|
828
824
|
None,
|
829
825
|
description="The DeclarativeOAuth Specific optional headers to inject while exchanging the `auth_code` to `access_token` during `completeOAuthFlow` step.",
|
830
|
-
examples=[
|
831
|
-
|
826
|
+
examples=[
|
827
|
+
{
|
828
|
+
"access_token_headers": {
|
829
|
+
"Authorization": "Basic {base64Encoder:{client_id}:{client_secret}}"
|
830
|
+
}
|
831
|
+
}
|
832
|
+
],
|
833
|
+
title="(Optional) DeclarativeOAuth Access Token Headers",
|
832
834
|
)
|
833
835
|
access_token_params: Optional[Dict[str, Any]] = Field(
|
834
836
|
None,
|
835
837
|
description="The DeclarativeOAuth Specific optional query parameters to inject while exchanging the `auth_code` to `access_token` during `completeOAuthFlow` step.\nWhen this property is provided, the query params will be encoded as `Json` and included in the outgoing API request.",
|
836
838
|
examples=[
|
837
839
|
{
|
838
|
-
"
|
839
|
-
|
840
|
-
|
840
|
+
"access_token_params": {
|
841
|
+
"{auth_code_key}": "{{auth_code_key}}",
|
842
|
+
"{client_id_key}": "{{client_id_key}}",
|
843
|
+
"{client_secret_key}": "{{client_secret_key}}",
|
844
|
+
}
|
841
845
|
}
|
842
846
|
],
|
843
|
-
title="Access Token Query Params (Json Encoded)",
|
847
|
+
title="(Optional) DeclarativeOAuth Access Token Query Params (Json Encoded)",
|
844
848
|
)
|
845
849
|
extract_output: List[str] = Field(
|
846
850
|
...,
|
847
851
|
description="The DeclarativeOAuth Specific list of strings to indicate which keys should be extracted and returned back to the input config.",
|
848
|
-
examples=[["access_token", "refresh_token", "other_field"]],
|
849
|
-
title="Extract Output",
|
852
|
+
examples=[{"extract_output": ["access_token", "refresh_token", "other_field"]}],
|
853
|
+
title="DeclarativeOAuth Extract Output",
|
850
854
|
)
|
851
855
|
state: Optional[State] = Field(
|
852
856
|
None,
|
853
857
|
description="The DeclarativeOAuth Specific object to provide the criteria of how the `state` query param should be constructed,\nincluding length and complexity.",
|
854
|
-
examples=[{"min": 7, "max": 128}],
|
855
|
-
title="Configurable State Query Param",
|
858
|
+
examples=[{"state": {"min": 7, "max": 128}}],
|
859
|
+
title="(Optional) DeclarativeOAuth Configurable State Query Param",
|
856
860
|
)
|
857
861
|
client_id_key: Optional[str] = Field(
|
858
862
|
None,
|
859
863
|
description="The DeclarativeOAuth Specific optional override to provide the custom `client_id` key name, if required by data-provider.",
|
860
|
-
examples=["my_custom_client_id_key_name"],
|
861
|
-
title="Client ID Key Override",
|
864
|
+
examples=[{"client_id_key": "my_custom_client_id_key_name"}],
|
865
|
+
title="(Optional) DeclarativeOAuth Client ID Key Override",
|
862
866
|
)
|
863
867
|
client_secret_key: Optional[str] = Field(
|
864
868
|
None,
|
865
869
|
description="The DeclarativeOAuth Specific optional override to provide the custom `client_secret` key name, if required by data-provider.",
|
866
|
-
examples=["my_custom_client_secret_key_name"],
|
867
|
-
title="Client Secret Key Override",
|
870
|
+
examples=[{"client_secret_key": "my_custom_client_secret_key_name"}],
|
871
|
+
title="(Optional) DeclarativeOAuth Client Secret Key Override",
|
868
872
|
)
|
869
873
|
scope_key: Optional[str] = Field(
|
870
874
|
None,
|
871
875
|
description="The DeclarativeOAuth Specific optional override to provide the custom `scope` key name, if required by data-provider.",
|
872
|
-
examples=["my_custom_scope_key_key_name"],
|
873
|
-
title="
|
876
|
+
examples=[{"scope_key": "my_custom_scope_key_key_name"}],
|
877
|
+
title="(Optional) DeclarativeOAuth Scope Key Override",
|
874
878
|
)
|
875
879
|
state_key: Optional[str] = Field(
|
876
880
|
None,
|
877
881
|
description="The DeclarativeOAuth Specific optional override to provide the custom `state` key name, if required by data-provider.",
|
878
|
-
examples=["my_custom_state_key_key_name"],
|
879
|
-
title="State Key Override",
|
882
|
+
examples=[{"state_key": "my_custom_state_key_key_name"}],
|
883
|
+
title="(Optional) DeclarativeOAuth State Key Override",
|
880
884
|
)
|
881
885
|
auth_code_key: Optional[str] = Field(
|
882
886
|
None,
|
883
887
|
description="The DeclarativeOAuth Specific optional override to provide the custom `code` key name to something like `auth_code` or `custom_auth_code`, if required by data-provider.",
|
884
|
-
examples=["my_custom_auth_code_key_name"],
|
885
|
-
title="Auth Code Key Override",
|
888
|
+
examples=[{"auth_code_key": "my_custom_auth_code_key_name"}],
|
889
|
+
title="(Optional) DeclarativeOAuth Auth Code Key Override",
|
886
890
|
)
|
887
891
|
redirect_uri_key: Optional[str] = Field(
|
888
892
|
None,
|
889
893
|
description="The DeclarativeOAuth Specific optional override to provide the custom `redirect_uri` key name to something like `callback_uri`, if required by data-provider.",
|
890
|
-
examples=["my_custom_redirect_uri_key_name"],
|
891
|
-
title="Redirect URI Key Override",
|
894
|
+
examples=[{"redirect_uri_key": "my_custom_redirect_uri_key_name"}],
|
895
|
+
title="(Optional) DeclarativeOAuth Redirect URI Key Override",
|
892
896
|
)
|
893
897
|
|
894
898
|
|
@@ -1664,16 +1668,7 @@ class DeclarativeStream(BaseModel):
|
|
1664
1668
|
title="Schema Loader",
|
1665
1669
|
)
|
1666
1670
|
transformations: Optional[
|
1667
|
-
List[
|
1668
|
-
Union[
|
1669
|
-
AddFields,
|
1670
|
-
CustomTransformation,
|
1671
|
-
RemoveFields,
|
1672
|
-
KeysToLower,
|
1673
|
-
KeysToSnakeCase,
|
1674
|
-
FlattenFields,
|
1675
|
-
]
|
1676
|
-
]
|
1671
|
+
List[Union[AddFields, CustomTransformation, RemoveFields, KeysToLower]]
|
1677
1672
|
] = Field(
|
1678
1673
|
None,
|
1679
1674
|
description="A list of transformations to be applied to each output record.",
|
@@ -1837,22 +1832,6 @@ class DynamicSchemaLoader(BaseModel):
|
|
1837
1832
|
description="Component used to coordinate how records are extracted across stream slices and request pages.",
|
1838
1833
|
title="Retriever",
|
1839
1834
|
)
|
1840
|
-
schema_transformations: Optional[
|
1841
|
-
List[
|
1842
|
-
Union[
|
1843
|
-
AddFields,
|
1844
|
-
CustomTransformation,
|
1845
|
-
RemoveFields,
|
1846
|
-
KeysToLower,
|
1847
|
-
KeysToSnakeCase,
|
1848
|
-
FlattenFields,
|
1849
|
-
]
|
1850
|
-
]
|
1851
|
-
] = Field(
|
1852
|
-
None,
|
1853
|
-
description="A list of transformations to be applied to the schema.",
|
1854
|
-
title="Schema Transformations",
|
1855
|
-
)
|
1856
1835
|
schema_type_identifier: SchemaTypeIdentifier
|
1857
1836
|
parameters: Optional[Dict[str, Any]] = Field(None, alias="$parameters")
|
1858
1837
|
|
@@ -197,9 +197,6 @@ from airbyte_cdk.sources.declarative.models.declarative_component_schema import
|
|
197
197
|
from airbyte_cdk.sources.declarative.models.declarative_component_schema import (
|
198
198
|
ExponentialBackoffStrategy as ExponentialBackoffStrategyModel,
|
199
199
|
)
|
200
|
-
from airbyte_cdk.sources.declarative.models.declarative_component_schema import (
|
201
|
-
FlattenFields as FlattenFieldsModel,
|
202
|
-
)
|
203
200
|
from airbyte_cdk.sources.declarative.models.declarative_component_schema import (
|
204
201
|
GzipJsonDecoder as GzipJsonDecoderModel,
|
205
202
|
)
|
@@ -239,9 +236,6 @@ from airbyte_cdk.sources.declarative.models.declarative_component_schema import
|
|
239
236
|
from airbyte_cdk.sources.declarative.models.declarative_component_schema import (
|
240
237
|
KeysToLower as KeysToLowerModel,
|
241
238
|
)
|
242
|
-
from airbyte_cdk.sources.declarative.models.declarative_component_schema import (
|
243
|
-
KeysToSnakeCase as KeysToSnakeCaseModel,
|
244
|
-
)
|
245
239
|
from airbyte_cdk.sources.declarative.models.declarative_component_schema import (
|
246
240
|
LegacySessionTokenAuthenticator as LegacySessionTokenAuthenticatorModel,
|
247
241
|
)
|
@@ -329,9 +323,6 @@ from airbyte_cdk.sources.declarative.partition_routers import (
|
|
329
323
|
SinglePartitionRouter,
|
330
324
|
SubstreamPartitionRouter,
|
331
325
|
)
|
332
|
-
from airbyte_cdk.sources.declarative.partition_routers.async_job_partition_router import (
|
333
|
-
AsyncJobPartitionRouter,
|
334
|
-
)
|
335
326
|
from airbyte_cdk.sources.declarative.partition_routers.substream_partition_router import (
|
336
327
|
ParentStreamConfig,
|
337
328
|
)
|
@@ -396,15 +387,9 @@ from airbyte_cdk.sources.declarative.transformations import (
|
|
396
387
|
RemoveFields,
|
397
388
|
)
|
398
389
|
from airbyte_cdk.sources.declarative.transformations.add_fields import AddedFieldDefinition
|
399
|
-
from airbyte_cdk.sources.declarative.transformations.flatten_fields import (
|
400
|
-
FlattenFields,
|
401
|
-
)
|
402
390
|
from airbyte_cdk.sources.declarative.transformations.keys_to_lower_transformation import (
|
403
391
|
KeysToLowerTransformation,
|
404
392
|
)
|
405
|
-
from airbyte_cdk.sources.declarative.transformations.keys_to_snake_transformation import (
|
406
|
-
KeysToSnakeCaseTransformation,
|
407
|
-
)
|
408
393
|
from airbyte_cdk.sources.message import (
|
409
394
|
InMemoryMessageRepository,
|
410
395
|
LogAppenderMessageRepositoryDecorator,
|
@@ -487,8 +472,6 @@ class ModelToComponentFactory:
|
|
487
472
|
JsonlDecoderModel: self.create_jsonl_decoder,
|
488
473
|
GzipJsonDecoderModel: self.create_gzipjson_decoder,
|
489
474
|
KeysToLowerModel: self.create_keys_to_lower_transformation,
|
490
|
-
KeysToSnakeCaseModel: self.create_keys_to_snake_transformation,
|
491
|
-
FlattenFieldsModel: self.create_flatten_fields,
|
492
475
|
IterableDecoderModel: self.create_iterable_decoder,
|
493
476
|
XmlDecoderModel: self.create_xml_decoder,
|
494
477
|
JsonFileSchemaLoaderModel: self.create_json_file_schema_loader,
|
@@ -604,16 +587,6 @@ class ModelToComponentFactory:
|
|
604
587
|
) -> KeysToLowerTransformation:
|
605
588
|
return KeysToLowerTransformation()
|
606
589
|
|
607
|
-
def create_keys_to_snake_transformation(
|
608
|
-
self, model: KeysToSnakeCaseModel, config: Config, **kwargs: Any
|
609
|
-
) -> KeysToSnakeCaseTransformation:
|
610
|
-
return KeysToSnakeCaseTransformation()
|
611
|
-
|
612
|
-
def create_flatten_fields(
|
613
|
-
self, model: FlattenFieldsModel, config: Config, **kwargs: Any
|
614
|
-
) -> FlattenFields:
|
615
|
-
return FlattenFields()
|
616
|
-
|
617
590
|
@staticmethod
|
618
591
|
def _json_schema_type_name_to_type(value_type: Optional[ValueType]) -> Optional[Type[Any]]:
|
619
592
|
if not value_type:
|
@@ -1665,13 +1638,6 @@ class ModelToComponentFactory:
|
|
1665
1638
|
model.retriever, stream_slicer
|
1666
1639
|
)
|
1667
1640
|
|
1668
|
-
schema_transformations = []
|
1669
|
-
if model.schema_transformations:
|
1670
|
-
for transformation_model in model.schema_transformations:
|
1671
|
-
schema_transformations.append(
|
1672
|
-
self._create_component_from_model(model=transformation_model, config=config)
|
1673
|
-
)
|
1674
|
-
|
1675
1641
|
retriever = self._create_component_from_model(
|
1676
1642
|
model=model.retriever,
|
1677
1643
|
config=config,
|
@@ -1686,7 +1652,6 @@ class ModelToComponentFactory:
|
|
1686
1652
|
return DynamicSchemaLoader(
|
1687
1653
|
retriever=retriever,
|
1688
1654
|
config=config,
|
1689
|
-
schema_transformations=schema_transformations,
|
1690
1655
|
schema_type_identifier=schema_type_identifier,
|
1691
1656
|
parameters=model.parameters or {},
|
1692
1657
|
)
|
@@ -2263,24 +2228,18 @@ class ModelToComponentFactory:
|
|
2263
2228
|
urls_extractor=urls_extractor,
|
2264
2229
|
)
|
2265
2230
|
|
2266
|
-
|
2231
|
+
return AsyncRetriever(
|
2267
2232
|
job_orchestrator_factory=lambda stream_slices: AsyncJobOrchestrator(
|
2268
2233
|
job_repository,
|
2269
2234
|
stream_slices,
|
2270
|
-
JobTracker(
|
2271
|
-
|
2235
|
+
JobTracker(
|
2236
|
+
1
|
2237
|
+
), # FIXME eventually make the number of concurrent jobs in the API configurable. Until then, we limit to 1
|
2272
2238
|
self._message_repository,
|
2273
|
-
has_bulk_parent=False,
|
2274
|
-
# FIXME work would need to be done here in order to detect if a stream as a parent stream that is bulk
|
2239
|
+
has_bulk_parent=False, # FIXME work would need to be done here in order to detect if a stream as a parent stream that is bulk
|
2275
2240
|
),
|
2276
|
-
stream_slicer=stream_slicer,
|
2277
|
-
config=config,
|
2278
|
-
parameters=model.parameters or {},
|
2279
|
-
)
|
2280
|
-
|
2281
|
-
return AsyncRetriever(
|
2282
2241
|
record_selector=record_selector,
|
2283
|
-
stream_slicer=
|
2242
|
+
stream_slicer=stream_slicer,
|
2284
2243
|
config=config,
|
2285
2244
|
parameters=model.parameters or {},
|
2286
2245
|
)
|
@@ -2,18 +2,10 @@
|
|
2
2
|
# Copyright (c) 2022 Airbyte, Inc., all rights reserved.
|
3
3
|
#
|
4
4
|
|
5
|
-
from airbyte_cdk.sources.declarative.partition_routers.async_job_partition_router import AsyncJobPartitionRouter
|
6
5
|
from airbyte_cdk.sources.declarative.partition_routers.cartesian_product_stream_slicer import CartesianProductStreamSlicer
|
7
6
|
from airbyte_cdk.sources.declarative.partition_routers.list_partition_router import ListPartitionRouter
|
8
7
|
from airbyte_cdk.sources.declarative.partition_routers.single_partition_router import SinglePartitionRouter
|
9
8
|
from airbyte_cdk.sources.declarative.partition_routers.substream_partition_router import SubstreamPartitionRouter
|
10
9
|
from airbyte_cdk.sources.declarative.partition_routers.partition_router import PartitionRouter
|
11
10
|
|
12
|
-
__all__ = [
|
13
|
-
"AsyncJobPartitionRouter",
|
14
|
-
"CartesianProductStreamSlicer",
|
15
|
-
"ListPartitionRouter",
|
16
|
-
"SinglePartitionRouter",
|
17
|
-
"SubstreamPartitionRouter",
|
18
|
-
"PartitionRouter"
|
19
|
-
]
|
11
|
+
__all__ = ["CartesianProductStreamSlicer", "ListPartitionRouter", "SinglePartitionRouter", "SubstreamPartitionRouter", "PartitionRouter"]
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# Copyright (c) 2024 Airbyte, Inc., all rights reserved.
|
2
2
|
|
3
3
|
|
4
|
-
from dataclasses import InitVar, dataclass
|
5
|
-
from typing import Any, Iterable, Mapping, Optional
|
4
|
+
from dataclasses import InitVar, dataclass, field
|
5
|
+
from typing import Any, Callable, Iterable, Mapping, Optional
|
6
6
|
|
7
7
|
from typing_extensions import deprecated
|
8
8
|
|
@@ -12,10 +12,9 @@ from airbyte_cdk.sources.declarative.async_job.job_orchestrator import (
|
|
12
12
|
AsyncPartition,
|
13
13
|
)
|
14
14
|
from airbyte_cdk.sources.declarative.extractors.record_selector import RecordSelector
|
15
|
-
from airbyte_cdk.sources.declarative.partition_routers
|
16
|
-
AsyncJobPartitionRouter,
|
17
|
-
)
|
15
|
+
from airbyte_cdk.sources.declarative.partition_routers import SinglePartitionRouter
|
18
16
|
from airbyte_cdk.sources.declarative.retrievers import Retriever
|
17
|
+
from airbyte_cdk.sources.declarative.stream_slicers import StreamSlicer
|
19
18
|
from airbyte_cdk.sources.source import ExperimentalClassWarning
|
20
19
|
from airbyte_cdk.sources.streams.core import StreamData
|
21
20
|
from airbyte_cdk.sources.types import Config, StreamSlice, StreamState
|
@@ -30,10 +29,15 @@ from airbyte_cdk.utils.traced_exception import AirbyteTracedException
|
|
30
29
|
class AsyncRetriever(Retriever):
|
31
30
|
config: Config
|
32
31
|
parameters: InitVar[Mapping[str, Any]]
|
32
|
+
job_orchestrator_factory: Callable[[Iterable[StreamSlice]], AsyncJobOrchestrator]
|
33
33
|
record_selector: RecordSelector
|
34
|
-
stream_slicer:
|
34
|
+
stream_slicer: StreamSlicer = field(
|
35
|
+
default_factory=lambda: SinglePartitionRouter(parameters={})
|
36
|
+
)
|
35
37
|
|
36
38
|
def __post_init__(self, parameters: Mapping[str, Any]) -> None:
|
39
|
+
self._job_orchestrator_factory = self.job_orchestrator_factory
|
40
|
+
self.__job_orchestrator: Optional[AsyncJobOrchestrator] = None
|
37
41
|
self._parameters = parameters
|
38
42
|
|
39
43
|
@property
|
@@ -50,6 +54,17 @@ class AsyncRetriever(Retriever):
|
|
50
54
|
"""
|
51
55
|
pass
|
52
56
|
|
57
|
+
@property
|
58
|
+
def _job_orchestrator(self) -> AsyncJobOrchestrator:
|
59
|
+
if not self.__job_orchestrator:
|
60
|
+
raise AirbyteTracedException(
|
61
|
+
message="Invalid state within AsyncJobRetriever. Please contact Airbyte Support",
|
62
|
+
internal_message="AsyncPartitionRepository is expected to be accessed only after `stream_slices`",
|
63
|
+
failure_type=FailureType.system_error,
|
64
|
+
)
|
65
|
+
|
66
|
+
return self.__job_orchestrator
|
67
|
+
|
53
68
|
def _get_stream_state(self) -> StreamState:
|
54
69
|
"""
|
55
70
|
Gets the current state of the stream.
|
@@ -84,7 +99,15 @@ class AsyncRetriever(Retriever):
|
|
84
99
|
return stream_slice["partition"] # type: ignore # stream_slice["partition"] has been added as an AsyncPartition as part of stream_slices
|
85
100
|
|
86
101
|
def stream_slices(self) -> Iterable[Optional[StreamSlice]]:
|
87
|
-
|
102
|
+
slices = self.stream_slicer.stream_slices()
|
103
|
+
self.__job_orchestrator = self._job_orchestrator_factory(slices)
|
104
|
+
|
105
|
+
for completed_partition in self._job_orchestrator.create_and_get_completed_partitions():
|
106
|
+
yield StreamSlice(
|
107
|
+
partition=dict(completed_partition.stream_slice.partition)
|
108
|
+
| {"partition": completed_partition},
|
109
|
+
cursor_slice=completed_partition.stream_slice.cursor_slice,
|
110
|
+
)
|
88
111
|
|
89
112
|
def read_records(
|
90
113
|
self,
|
@@ -93,7 +116,7 @@ class AsyncRetriever(Retriever):
|
|
93
116
|
) -> Iterable[StreamData]:
|
94
117
|
stream_state: StreamState = self._get_stream_state()
|
95
118
|
partition: AsyncPartition = self._validate_and_get_stream_slice_partition(stream_slice)
|
96
|
-
records: Iterable[Mapping[str, Any]] = self.
|
119
|
+
records: Iterable[Mapping[str, Any]] = self._job_orchestrator.fetch_records(partition)
|
97
120
|
|
98
121
|
yield from self.record_selector.filter_and_transform(
|
99
122
|
all_data=records,
|
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
|
6
6
|
from copy import deepcopy
|
7
|
-
from dataclasses import InitVar, dataclass
|
7
|
+
from dataclasses import InitVar, dataclass
|
8
8
|
from typing import Any, List, Mapping, MutableMapping, Optional, Union
|
9
9
|
|
10
10
|
import dpath
|
@@ -13,9 +13,8 @@ from typing_extensions import deprecated
|
|
13
13
|
from airbyte_cdk.sources.declarative.interpolation.interpolated_string import InterpolatedString
|
14
14
|
from airbyte_cdk.sources.declarative.retrievers.retriever import Retriever
|
15
15
|
from airbyte_cdk.sources.declarative.schema.schema_loader import SchemaLoader
|
16
|
-
from airbyte_cdk.sources.declarative.transformations import RecordTransformation
|
17
16
|
from airbyte_cdk.sources.source import ExperimentalClassWarning
|
18
|
-
from airbyte_cdk.sources.types import Config
|
17
|
+
from airbyte_cdk.sources.types import Config
|
19
18
|
|
20
19
|
AIRBYTE_DATA_TYPES: Mapping[str, Mapping[str, Any]] = {
|
21
20
|
"string": {"type": ["null", "string"]},
|
@@ -104,7 +103,6 @@ class DynamicSchemaLoader(SchemaLoader):
|
|
104
103
|
config: Config
|
105
104
|
parameters: InitVar[Mapping[str, Any]]
|
106
105
|
schema_type_identifier: SchemaTypeIdentifier
|
107
|
-
schema_transformations: List[RecordTransformation] = field(default_factory=lambda: [])
|
108
106
|
|
109
107
|
def get_json_schema(self) -> Mapping[str, Any]:
|
110
108
|
"""
|
@@ -130,27 +128,12 @@ class DynamicSchemaLoader(SchemaLoader):
|
|
130
128
|
)
|
131
129
|
properties[key] = value
|
132
130
|
|
133
|
-
transformed_properties = self._transform(properties, {})
|
134
|
-
|
135
131
|
return {
|
136
132
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
137
133
|
"type": "object",
|
138
|
-
"properties":
|
134
|
+
"properties": properties,
|
139
135
|
}
|
140
136
|
|
141
|
-
def _transform(
|
142
|
-
self,
|
143
|
-
properties: Mapping[str, Any],
|
144
|
-
stream_state: StreamState,
|
145
|
-
stream_slice: Optional[StreamSlice] = None,
|
146
|
-
) -> Mapping[str, Any]:
|
147
|
-
for transformation in self.schema_transformations:
|
148
|
-
transformation.transform(
|
149
|
-
properties, # type: ignore # properties has type Mapping[str, Any], but Dict[str, Any] expected
|
150
|
-
config=self.config,
|
151
|
-
)
|
152
|
-
return properties
|
153
|
-
|
154
137
|
def _get_key(
|
155
138
|
self,
|
156
139
|
raw_schema: MutableMapping[str, Any],
|
@@ -223,17 +223,17 @@ class Stream(ABC):
|
|
223
223
|
record_counter += 1
|
224
224
|
|
225
225
|
checkpoint_interval = self.state_checkpoint_interval
|
226
|
-
checkpoint = checkpoint_reader.get_checkpoint()
|
227
226
|
if (
|
228
227
|
should_checkpoint
|
229
228
|
and checkpoint_interval
|
230
229
|
and record_counter % checkpoint_interval == 0
|
231
|
-
and checkpoint is not None
|
232
230
|
):
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
231
|
+
checkpoint = checkpoint_reader.get_checkpoint()
|
232
|
+
if checkpoint:
|
233
|
+
airbyte_state_message = self._checkpoint_state(
|
234
|
+
checkpoint, state_manager=state_manager
|
235
|
+
)
|
236
|
+
yield airbyte_state_message
|
237
237
|
|
238
238
|
if internal_config.is_limit_reached(record_counter):
|
239
239
|
break
|
@@ -262,7 +262,7 @@ class HttpClient:
|
|
262
262
|
user_backoff_handler = user_defined_backoff_handler(max_tries=max_tries, max_time=max_time)(
|
263
263
|
self._send
|
264
264
|
)
|
265
|
-
rate_limit_backoff_handler = rate_limit_default_backoff_handler(
|
265
|
+
rate_limit_backoff_handler = rate_limit_default_backoff_handler()
|
266
266
|
backoff_handler = http_client_default_backoff_handler(
|
267
267
|
max_tries=max_tries, max_time=max_time
|
268
268
|
)
|
@@ -472,9 +472,7 @@ class HttpClient:
|
|
472
472
|
|
473
473
|
elif retry_endlessly:
|
474
474
|
raise RateLimitBackoffException(
|
475
|
-
request=request,
|
476
|
-
response=(response if response is not None else exc),
|
477
|
-
error_message=error_message,
|
475
|
+
request=request, response=response or exc, error_message=error_message
|
478
476
|
)
|
479
477
|
|
480
478
|
raise DefaultBackoffException(
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: airbyte-cdk
|
3
|
-
Version: 6.12.1
|
3
|
+
Version: 6.12.1.dev0
|
4
4
|
Summary: A framework for writing Airbyte Connectors.
|
5
5
|
Home-page: https://airbyte.com
|
6
6
|
License: MIT
|
@@ -22,7 +22,6 @@ Provides-Extra: sql
|
|
22
22
|
Provides-Extra: vector-db-based
|
23
23
|
Requires-Dist: Jinja2 (>=3.1.2,<3.2.0)
|
24
24
|
Requires-Dist: PyYAML (>=6.0.1,<7.0.0)
|
25
|
-
Requires-Dist: Unidecode (>=1.3,<2.0)
|
26
25
|
Requires-Dist: airbyte-protocol-models-dataclasses (>=0.14,<0.15)
|
27
26
|
Requires-Dist: avro (>=1.11.2,<1.12.0) ; extra == "file-based"
|
28
27
|
Requires-Dist: backoff
|
@@ -66,7 +66,7 @@ airbyte_cdk/sources/declarative/concurrent_declarative_source.py,sha256=PxP4p268
|
|
66
66
|
airbyte_cdk/sources/declarative/datetime/__init__.py,sha256=l9LG7Qm6e5r_qgqfVKnx3mXYtg1I9MmMjomVIPfU4XA,177
|
67
67
|
airbyte_cdk/sources/declarative/datetime/datetime_parser.py,sha256=SX9JjdesN1edN2WVUVMzU_ptqp2QB1OnsnjZ4mwcX7w,2579
|
68
68
|
airbyte_cdk/sources/declarative/datetime/min_max_datetime.py,sha256=0BHBtDNQZfvwM45-tY5pNlTcKAFSGGNxemoi0Jic-0E,5785
|
69
|
-
airbyte_cdk/sources/declarative/declarative_component_schema.yaml,sha256=
|
69
|
+
airbyte_cdk/sources/declarative/declarative_component_schema.yaml,sha256=bmuzrO0q4yeRXXkAMAFdzgtDx2gF8-k8ERq2MqVMgq4,128593
|
70
70
|
airbyte_cdk/sources/declarative/declarative_source.py,sha256=nF7wBqFd3AQmEKAm4CnIo29CJoQL562cJGSCeL8U8bA,1531
|
71
71
|
airbyte_cdk/sources/declarative/declarative_stream.py,sha256=JRyNeOIpsFu4ztVZsN6sncqUEIqIE-bUkD2TPgbMgk0,10375
|
72
72
|
airbyte_cdk/sources/declarative/decoders/__init__.py,sha256=hNlhaB5FjNC6IfJyglj5ZJWkYD2nEAukMDmzRz5PC6o,671
|
@@ -104,14 +104,13 @@ airbyte_cdk/sources/declarative/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW
|
|
104
104
|
airbyte_cdk/sources/declarative/migrations/legacy_to_per_partition_state_migration.py,sha256=iemy3fKLczcU0-Aor7tx5jcT6DRedKMqyK7kCOp01hg,3924
|
105
105
|
airbyte_cdk/sources/declarative/migrations/state_migration.py,sha256=KWPjealMLKSMtajXgkdGgKg7EmTLR-CqqD7UIh0-eDU,794
|
106
106
|
airbyte_cdk/sources/declarative/models/__init__.py,sha256=nUFxNCiKeYRVXuZEKA7GD-lTHxsiKcQ8FitZjKhPIvE,100
|
107
|
-
airbyte_cdk/sources/declarative/models/declarative_component_schema.py,sha256
|
107
|
+
airbyte_cdk/sources/declarative/models/declarative_component_schema.py,sha256=-XTzt8EY23Qel7KZINQIbQOoBWqdiK6am-p7A615AI0,90753
|
108
108
|
airbyte_cdk/sources/declarative/parsers/__init__.py,sha256=ZnqYNxHsKCgO38IwB34RQyRMXTs4GTvlRi3ImKnIioo,61
|
109
109
|
airbyte_cdk/sources/declarative/parsers/custom_exceptions.py,sha256=Rir9_z3Kcd5Es0-LChrzk-0qubAsiK_RSEnLmK2OXm8,553
|
110
110
|
airbyte_cdk/sources/declarative/parsers/manifest_component_transformer.py,sha256=CXwTfD3wSQq3okcqwigpprbHhSURUokh4GK2OmOyKC8,9132
|
111
111
|
airbyte_cdk/sources/declarative/parsers/manifest_reference_resolver.py,sha256=IWUOdF03o-aQn0Occo1BJCxU0Pz-QILk5L67nzw2thw,6803
|
112
|
-
airbyte_cdk/sources/declarative/parsers/model_to_component_factory.py,sha256=
|
113
|
-
airbyte_cdk/sources/declarative/partition_routers/__init__.py,sha256=
|
114
|
-
airbyte_cdk/sources/declarative/partition_routers/async_job_partition_router.py,sha256=n82J15S8bjeMZ5uROu--P3hnbQoxkY5v7RPHYx7g7ro,2929
|
112
|
+
airbyte_cdk/sources/declarative/parsers/model_to_component_factory.py,sha256=UWUlj6m2WT9SspMtvvhni31FoQBrkqnHGzrwFKem-Qc,104367
|
113
|
+
airbyte_cdk/sources/declarative/partition_routers/__init__.py,sha256=1NjaZoGAIefvWwj6wx-LOKIXXWS-UnBlZFnuR7y6uYA,745
|
115
114
|
airbyte_cdk/sources/declarative/partition_routers/cartesian_product_stream_slicer.py,sha256=c5cuVFM6NFkuQqG8Z5IwkBuwDrvXZN1CunUOM_L0ezg,6892
|
116
115
|
airbyte_cdk/sources/declarative/partition_routers/list_partition_router.py,sha256=t7pRdFWfFWJtQQG19c9PVeMODyO2BknRTakpM5U9N-8,4844
|
117
116
|
airbyte_cdk/sources/declarative/partition_routers/partition_router.py,sha256=YyEIzdmLd1FjbVP3QbQ2VFCLW_P-OGbVh6VpZShp54k,2218
|
@@ -158,12 +157,12 @@ airbyte_cdk/sources/declarative/resolvers/components_resolver.py,sha256=KPjKc0yb
|
|
158
157
|
airbyte_cdk/sources/declarative/resolvers/config_components_resolver.py,sha256=dz4iJV9liD_LzY_Mn4XmAStoUll60R3MIGWV4aN3pgg,5223
|
159
158
|
airbyte_cdk/sources/declarative/resolvers/http_components_resolver.py,sha256=ZA2vrHQKfXNMcH3x1iuyFOTGNzYDhUFT2qcaiOzSK0A,4271
|
160
159
|
airbyte_cdk/sources/declarative/retrievers/__init__.py,sha256=FVQpUGVwp2Gibk4gp07VmLKX5AafUlsZWFSrDpUDuJM,443
|
161
|
-
airbyte_cdk/sources/declarative/retrievers/async_retriever.py,sha256=
|
160
|
+
airbyte_cdk/sources/declarative/retrievers/async_retriever.py,sha256=WDFnjrXLz3-YEjFhmlMkWAn9AJvnZ0mk9FyC8DAhEYk,4976
|
162
161
|
airbyte_cdk/sources/declarative/retrievers/retriever.py,sha256=XPLs593Xv8c5cKMc37XzUAYmzlXd1a7eSsspM-CMuWA,1696
|
163
162
|
airbyte_cdk/sources/declarative/retrievers/simple_retriever.py,sha256=N4swGw5mfuTXJ2R7AKX18CHzizsr69pXwt5uSHLPi48,24172
|
164
163
|
airbyte_cdk/sources/declarative/schema/__init__.py,sha256=Io9vninzlEjQ2uFmWklxfwNM0cXfljtzOz5zL1OVyT4,701
|
165
164
|
airbyte_cdk/sources/declarative/schema/default_schema_loader.py,sha256=KTACrIE23a83wsm3Rd9Eb4K6-20lrGqYxTHNp9yxsso,1820
|
166
|
-
airbyte_cdk/sources/declarative/schema/dynamic_schema_loader.py,sha256=
|
165
|
+
airbyte_cdk/sources/declarative/schema/dynamic_schema_loader.py,sha256=tP5DIEMn-k2JshWeXmo53ZEudDAVb4AJ50Z5tfme_ZU,8063
|
167
166
|
airbyte_cdk/sources/declarative/schema/inline_schema_loader.py,sha256=bVETE10hRsatRJq3R3BeyRR0wIoK3gcP1gcpVRQ_P5U,464
|
168
167
|
airbyte_cdk/sources/declarative/schema/json_file_schema_loader.py,sha256=5Wl-fqW-pVf_dxJ4yGHMAFfC4JjKHYJhqFJT1xA57F4,4177
|
169
168
|
airbyte_cdk/sources/declarative/schema/schema_loader.py,sha256=kjt8v0N5wWKA5zyLnrDLxf1PJKdUqvQq2RVnAOAzNSY,379
|
@@ -174,9 +173,7 @@ airbyte_cdk/sources/declarative/stream_slicers/declarative_partition_generator.p
|
|
174
173
|
airbyte_cdk/sources/declarative/stream_slicers/stream_slicer.py,sha256=SOkIPBi2Wu7yxIvA15yFzUAB95a3IzA8LPq5DEqHQQc,725
|
175
174
|
airbyte_cdk/sources/declarative/transformations/__init__.py,sha256=CPJ8TlMpiUmvG3624VYu_NfTzxwKcfBjM2Q2wJ7fkSA,919
|
176
175
|
airbyte_cdk/sources/declarative/transformations/add_fields.py,sha256=r4YdAuAk2bQtNWJMztIIy2CC-NglD9NeK1s1TeO9wkw,5027
|
177
|
-
airbyte_cdk/sources/declarative/transformations/flatten_fields.py,sha256=ti9fLVk-EpMeDY7ImduvQq1YGounLYmH9dHzp7MIRxk,1703
|
178
176
|
airbyte_cdk/sources/declarative/transformations/keys_to_lower_transformation.py,sha256=RTs5KX4V3hM7A6QN1WlGF21YccTIyNH6qQI9IMb__hw,670
|
179
|
-
airbyte_cdk/sources/declarative/transformations/keys_to_snake_transformation.py,sha256=43zwe6_F5ba5C4eY0RgXxPz7ndPKZfXGChHepFn-2lk,2263
|
180
177
|
airbyte_cdk/sources/declarative/transformations/remove_fields.py,sha256=EwUP0SZ2p4GRJ6Q8CUzlz9dcUeEidEFDlI2IBye2tlc,2745
|
181
178
|
airbyte_cdk/sources/declarative/transformations/transformation.py,sha256=4sXtx9cNY2EHUPq-xHvDs8GQEBUy3Eo6TkRLKHPXx68,1161
|
182
179
|
airbyte_cdk/sources/declarative/types.py,sha256=yqx0xlZv_76tkC7fqJKefmvl4GJJ8mXbeddwVV8XRJU,778
|
@@ -267,7 +264,7 @@ airbyte_cdk/sources/streams/concurrent/partitions/types.py,sha256=frPVvHtY7vLxpG
|
|
267
264
|
airbyte_cdk/sources/streams/concurrent/state_converters/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
268
265
|
airbyte_cdk/sources/streams/concurrent/state_converters/abstract_stream_state_converter.py,sha256=CXHUMOhndu-LOKgsnNTItv5s5qrKpmJDeHOzlH1nBy8,6819
|
269
266
|
airbyte_cdk/sources/streams/concurrent/state_converters/datetime_stream_state_converter.py,sha256=syjdxEoElIOzqVS5Jrm5FOR70jsbBdttEO_3Iz12Jyo,7523
|
270
|
-
airbyte_cdk/sources/streams/core.py,sha256=
|
267
|
+
airbyte_cdk/sources/streams/core.py,sha256=jiYW6w8cjNjzXMd8U8Gt-02fYYU7b0ciXSSSnGvFRak,32219
|
271
268
|
airbyte_cdk/sources/streams/http/__init__.py,sha256=NXaNlkzZMkh5kS8S5ujEaKEE6855sk6_HljF_GFjKZI,311
|
272
269
|
airbyte_cdk/sources/streams/http/availability_strategy.py,sha256=sovoGFThZr-doMN9vJvTuJBrvkwQVIO0qTQO64pGZPY,2428
|
273
270
|
airbyte_cdk/sources/streams/http/error_handlers/__init__.py,sha256=R8OgTcratGH4f6BbYM2Hp8qYyEk7wMYuyda5H9ohGW8,665
|
@@ -281,7 +278,7 @@ airbyte_cdk/sources/streams/http/error_handlers/json_error_message_parser.py,sha
|
|
281
278
|
airbyte_cdk/sources/streams/http/error_handlers/response_models.py,sha256=xGIVELBFY0TmH9aUq1ikoqJz8oHLr6di2JLvKWVEO-s,2236
|
282
279
|
airbyte_cdk/sources/streams/http/exceptions.py,sha256=njC7MlMJoFYcSGz4mIp6-bqLFTr6vC8ej25X0oSeyjE,1824
|
283
280
|
airbyte_cdk/sources/streams/http/http.py,sha256=JAMpiTdS9HFNOlwayWNvQdxoqs2rpW9wdYlhFHv_1Q4,28496
|
284
|
-
airbyte_cdk/sources/streams/http/http_client.py,sha256=
|
281
|
+
airbyte_cdk/sources/streams/http/http_client.py,sha256=dyNrbcahEnDfGTrhqkr1XdfPiuVVRlKOdj-TJ5WRVrk,22923
|
285
282
|
airbyte_cdk/sources/streams/http/rate_limiting.py,sha256=IwdjrHKUnU97XO4qONgYRv4YYW51xQ8SJm4WLafXDB8,6351
|
286
283
|
airbyte_cdk/sources/streams/http/requests_native_auth/__init__.py,sha256=RN0D3nOX1xLgwEwKWu6pkGy3XqBFzKSNZ8Lf6umU2eY,413
|
287
284
|
airbyte_cdk/sources/streams/http/requests_native_auth/abstract_oauth.py,sha256=nxI94yJ3bGfpDO8RR3QvOJ-PSW0n9CElSAkgl5ae80Y,10321
|
@@ -339,8 +336,8 @@ airbyte_cdk/utils/slice_hasher.py,sha256=-pHexlNYoWYPnXNH-M7HEbjmeJe9Zk7SJijdQ7d
|
|
339
336
|
airbyte_cdk/utils/spec_schema_transformations.py,sha256=-5HTuNsnDBAhj-oLeQXwpTGA0HdcjFOf2zTEMUTTg_Y,816
|
340
337
|
airbyte_cdk/utils/stream_status_utils.py,sha256=ZmBoiy5HVbUEHAMrUONxZvxnvfV9CesmQJLDTAIWnWw,1171
|
341
338
|
airbyte_cdk/utils/traced_exception.py,sha256=C8uIBuCL_E4WnBAOPSxBicD06JAldoN9fGsQDp463OY,6292
|
342
|
-
airbyte_cdk-6.12.1.dist-info/LICENSE.txt,sha256=Wfe61S4BaGPj404v8lrAbvhjYR68SHlkzeYrg3_bbuM,1051
|
343
|
-
airbyte_cdk-6.12.1.dist-info/METADATA,sha256=
|
344
|
-
airbyte_cdk-6.12.1.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
345
|
-
airbyte_cdk-6.12.1.dist-info/entry_points.txt,sha256=fj-e3PAQvsxsQzyyq8UkG1k8spunWnD4BAH2AwlR6NM,95
|
346
|
-
airbyte_cdk-6.12.1.dist-info/RECORD,,
|
339
|
+
airbyte_cdk-6.12.1.dev0.dist-info/LICENSE.txt,sha256=Wfe61S4BaGPj404v8lrAbvhjYR68SHlkzeYrg3_bbuM,1051
|
340
|
+
airbyte_cdk-6.12.1.dev0.dist-info/METADATA,sha256=wuEYLVSyehdNYlyYVlLw9n2uOyx1aT_WRmRnDlfHu0s,5955
|
341
|
+
airbyte_cdk-6.12.1.dev0.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
342
|
+
airbyte_cdk-6.12.1.dev0.dist-info/entry_points.txt,sha256=fj-e3PAQvsxsQzyyq8UkG1k8spunWnD4BAH2AwlR6NM,95
|
343
|
+
airbyte_cdk-6.12.1.dev0.dist-info/RECORD,,
|
@@ -1,65 +0,0 @@
|
|
1
|
-
# Copyright (c) 2024 Airbyte, Inc., all rights reserved.
|
2
|
-
|
3
|
-
from dataclasses import InitVar, dataclass, field
|
4
|
-
from typing import Any, Callable, Iterable, Mapping, Optional
|
5
|
-
|
6
|
-
from airbyte_cdk.models import FailureType
|
7
|
-
from airbyte_cdk.sources.declarative.async_job.job_orchestrator import (
|
8
|
-
AsyncJobOrchestrator,
|
9
|
-
AsyncPartition,
|
10
|
-
)
|
11
|
-
from airbyte_cdk.sources.declarative.partition_routers.single_partition_router import (
|
12
|
-
SinglePartitionRouter,
|
13
|
-
)
|
14
|
-
from airbyte_cdk.sources.streams.concurrent.partitions.stream_slicer import StreamSlicer
|
15
|
-
from airbyte_cdk.sources.types import Config, StreamSlice
|
16
|
-
from airbyte_cdk.utils.traced_exception import AirbyteTracedException
|
17
|
-
|
18
|
-
|
19
|
-
@dataclass
|
20
|
-
class AsyncJobPartitionRouter(StreamSlicer):
|
21
|
-
"""
|
22
|
-
Partition router that creates async jobs in a source API, periodically polls for job
|
23
|
-
completion, and supplies the completed job URL locations as stream slices so that
|
24
|
-
records can be extracted.
|
25
|
-
"""
|
26
|
-
|
27
|
-
config: Config
|
28
|
-
parameters: InitVar[Mapping[str, Any]]
|
29
|
-
job_orchestrator_factory: Callable[[Iterable[StreamSlice]], AsyncJobOrchestrator]
|
30
|
-
stream_slicer: StreamSlicer = field(
|
31
|
-
default_factory=lambda: SinglePartitionRouter(parameters={})
|
32
|
-
)
|
33
|
-
|
34
|
-
def __post_init__(self, parameters: Mapping[str, Any]) -> None:
|
35
|
-
self._job_orchestrator_factory = self.job_orchestrator_factory
|
36
|
-
self._job_orchestrator: Optional[AsyncJobOrchestrator] = None
|
37
|
-
self._parameters = parameters
|
38
|
-
|
39
|
-
def stream_slices(self) -> Iterable[StreamSlice]:
|
40
|
-
slices = self.stream_slicer.stream_slices()
|
41
|
-
self._job_orchestrator = self._job_orchestrator_factory(slices)
|
42
|
-
|
43
|
-
for completed_partition in self._job_orchestrator.create_and_get_completed_partitions():
|
44
|
-
yield StreamSlice(
|
45
|
-
partition=dict(completed_partition.stream_slice.partition)
|
46
|
-
| {"partition": completed_partition},
|
47
|
-
cursor_slice=completed_partition.stream_slice.cursor_slice,
|
48
|
-
)
|
49
|
-
|
50
|
-
def fetch_records(self, partition: AsyncPartition) -> Iterable[Mapping[str, Any]]:
|
51
|
-
"""
|
52
|
-
This method of fetching records extends beyond what a PartitionRouter/StreamSlicer should
|
53
|
-
be responsible for. However, this was added in because the JobOrchestrator is required to
|
54
|
-
retrieve records. And without defining fetch_records() on this class, we're stuck with either
|
55
|
-
passing the JobOrchestrator to the AsyncRetriever or storing it on multiple classes.
|
56
|
-
"""
|
57
|
-
|
58
|
-
if not self._job_orchestrator:
|
59
|
-
raise AirbyteTracedException(
|
60
|
-
message="Invalid state within AsyncJobRetriever. Please contact Airbyte Support",
|
61
|
-
internal_message="AsyncPartitionRepository is expected to be accessed only after `stream_slices`",
|
62
|
-
failure_type=FailureType.system_error,
|
63
|
-
)
|
64
|
-
|
65
|
-
return self._job_orchestrator.fetch_records(partition=partition)
|
@@ -1,50 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Copyright (c) 2024 Airbyte, Inc., all rights reserved.
|
3
|
-
#
|
4
|
-
|
5
|
-
from dataclasses import dataclass
|
6
|
-
from typing import Any, Dict, Optional
|
7
|
-
|
8
|
-
from airbyte_cdk.sources.declarative.transformations import RecordTransformation
|
9
|
-
from airbyte_cdk.sources.types import Config, StreamSlice, StreamState
|
10
|
-
|
11
|
-
|
12
|
-
@dataclass
|
13
|
-
class FlattenFields(RecordTransformation):
|
14
|
-
def transform(
|
15
|
-
self,
|
16
|
-
record: Dict[str, Any],
|
17
|
-
config: Optional[Config] = None,
|
18
|
-
stream_state: Optional[StreamState] = None,
|
19
|
-
stream_slice: Optional[StreamSlice] = None,
|
20
|
-
) -> None:
|
21
|
-
transformed_record = self.flatten_record(record)
|
22
|
-
record.clear()
|
23
|
-
record.update(transformed_record)
|
24
|
-
|
25
|
-
def flatten_record(self, record: Dict[str, Any]) -> Dict[str, Any]:
|
26
|
-
stack = [(record, "_")]
|
27
|
-
transformed_record: Dict[str, Any] = {}
|
28
|
-
force_with_parent_name = False
|
29
|
-
|
30
|
-
while stack:
|
31
|
-
current_record, parent_key = stack.pop()
|
32
|
-
|
33
|
-
if isinstance(current_record, dict):
|
34
|
-
for current_key, value in current_record.items():
|
35
|
-
new_key = (
|
36
|
-
f"{parent_key}.{current_key}"
|
37
|
-
if (current_key in transformed_record or force_with_parent_name)
|
38
|
-
else current_key
|
39
|
-
)
|
40
|
-
stack.append((value, new_key))
|
41
|
-
|
42
|
-
elif isinstance(current_record, list):
|
43
|
-
for i, item in enumerate(current_record):
|
44
|
-
force_with_parent_name = True
|
45
|
-
stack.append((item, f"{parent_key}.{i}"))
|
46
|
-
|
47
|
-
else:
|
48
|
-
transformed_record[parent_key] = current_record
|
49
|
-
|
50
|
-
return transformed_record
|
@@ -1,68 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Copyright (c) 2024 Airbyte, Inc., all rights reserved.
|
3
|
-
#
|
4
|
-
|
5
|
-
import re
|
6
|
-
from dataclasses import dataclass
|
7
|
-
from typing import Any, Dict, List, Optional
|
8
|
-
|
9
|
-
import unidecode
|
10
|
-
|
11
|
-
from airbyte_cdk.sources.declarative.transformations import RecordTransformation
|
12
|
-
from airbyte_cdk.sources.types import Config, StreamSlice, StreamState
|
13
|
-
|
14
|
-
|
15
|
-
@dataclass
|
16
|
-
class KeysToSnakeCaseTransformation(RecordTransformation):
|
17
|
-
token_pattern: re.Pattern[str] = re.compile(
|
18
|
-
r"[A-Z]+[a-z]*|[a-z]+|\d+|(?P<NoToken>[^a-zA-Z\d]+)"
|
19
|
-
)
|
20
|
-
|
21
|
-
def transform(
|
22
|
-
self,
|
23
|
-
record: Dict[str, Any],
|
24
|
-
config: Optional[Config] = None,
|
25
|
-
stream_state: Optional[StreamState] = None,
|
26
|
-
stream_slice: Optional[StreamSlice] = None,
|
27
|
-
) -> None:
|
28
|
-
transformed_record = self._transform_record(record)
|
29
|
-
record.clear()
|
30
|
-
record.update(transformed_record)
|
31
|
-
|
32
|
-
def _transform_record(self, record: Dict[str, Any]) -> Dict[str, Any]:
|
33
|
-
transformed_record = {}
|
34
|
-
for key, value in record.items():
|
35
|
-
transformed_key = self.process_key(key)
|
36
|
-
transformed_value = value
|
37
|
-
|
38
|
-
if isinstance(value, dict):
|
39
|
-
transformed_value = self._transform_record(value)
|
40
|
-
|
41
|
-
transformed_record[transformed_key] = transformed_value
|
42
|
-
return transformed_record
|
43
|
-
|
44
|
-
def process_key(self, key: str) -> str:
|
45
|
-
key = self.normalize_key(key)
|
46
|
-
tokens = self.tokenize_key(key)
|
47
|
-
tokens = self.filter_tokens(tokens)
|
48
|
-
return self.tokens_to_snake_case(tokens)
|
49
|
-
|
50
|
-
def normalize_key(self, key: str) -> str:
|
51
|
-
return unidecode.unidecode(key)
|
52
|
-
|
53
|
-
def tokenize_key(self, key: str) -> List[str]:
|
54
|
-
tokens = []
|
55
|
-
for match in self.token_pattern.finditer(key):
|
56
|
-
token = match.group(0) if match.group("NoToken") is None else ""
|
57
|
-
tokens.append(token)
|
58
|
-
return tokens
|
59
|
-
|
60
|
-
def filter_tokens(self, tokens: List[str]) -> List[str]:
|
61
|
-
if len(tokens) >= 3:
|
62
|
-
tokens = tokens[:1] + [t for t in tokens[1:-1] if t] + tokens[-1:]
|
63
|
-
if tokens and tokens[0].isdigit():
|
64
|
-
tokens.insert(0, "")
|
65
|
-
return tokens
|
66
|
-
|
67
|
-
def tokens_to_snake_case(self, tokens: List[str]) -> str:
|
68
|
-
return "_".join(token.lower() for token in tokens)
|
File without changes
|
File without changes
|
File without changes
|