Skip to content

Commit 9dece24

Browse files
committed
Integrate the DpathEnhancingExtractor in the UI of Airbyte.
Created a DPath Enhancing Extractor Refactored the record enhancement logic - moved to the extracted class Split the tests of DPathExtractor and DPathEnhancingExtractor Fix the failing tests: FAILED unit_tests/sources/declarative/parsers/test_model_to_component_factory.py::test_create_custom_components[test_create_custom_component_with_subcomponent_that_uses_parameters] FAILED unit_tests/sources/declarative/parsers/test_model_to_component_factory.py::test_custom_components_do_not_contain_extra_fields FAILED unit_tests/sources/declarative/parsers/test_model_to_component_factory.py::test_parse_custom_component_fields_if_subcomponent FAILED unit_tests/sources/declarative/parsers/test_model_to_component_factory.py::test_create_page_increment FAILED unit_tests/sources/declarative/parsers/test_model_to_component_factory.py::test_create_offset_increment FAILED unit_tests/sources/file_based/test_file_based_scenarios.py::test_file_based_read[simple_unstructured_scenario] FAILED unit_tests/sources/file_based/test_file_based_scenarios.py::test_file_based_read[no_file_extension_unstructured_scenario] They faile because of comparing string and int values of the page_size (public) attribute. Imposed an invariant: on construction, page_size can be set to a string or int keep only values of one type in page_size for uniform comparison (convert the values of the other type) _page_size holds the internal / working value ... unless manipulated directly. Merged: feat(low-code concurrent): Allow async job low-code streams that are incremental to be run by the concurrent framework (airbytehq#228) fix(low-code): Fix declarative low-code state migration in SubstreamPartitionRouter (airbytehq#267) feat: combine slash command jobs into single job steps (airbytehq#266) feat(low-code): add items and property mappings to dynamic schemas (airbytehq#256) feat: add help response for unrecognized slash commands (airbytehq#264) ci: post direct links to html connector test reports (airbytehq#252) (airbytehq#263) fix(low-code): Fix legacy state migration in SubstreamPartitionRouter (airbytehq#261) fix(airbyte-cdk): Fix RequestOptionsProvider for PerPartitionWithGlobalCursor (airbytehq#254) feat(low-code): add profile assertion flow to oauth authenticator component (airbytehq#236) feat(Low-Code Concurrent CDK): Add ConcurrentPerPartitionCursor (airbytehq#111) fix: don't mypy unit_tests (airbytehq#241) fix: handle backoff_strategies in CompositeErrorHandler (airbytehq#225) feat(concurrent cursor): attempt at clamping datetime (airbytehq#234) fix(airbyte-cdk): Fix RequestOptionsProvider for PerPartitionWithGlobalCursor (airbytehq#254) feat(low-code): add profile assertion flow to oauth authenticator component (airbytehq#236) feat(Low-Code Concurrent CDK): Add ConcurrentPerPartitionCursor (airbytehq#111) fix: don't mypy unit_tests (airbytehq#241) fix: handle backoff_strategies in CompositeErrorHandler (airbytehq#225) feat(concurrent cursor): attempt at clamping datetime (airbytehq#234) ci: use `ubuntu-24.04` explicitly (resolves CI warnings) (airbytehq#244) Fix(sdm): module ref issue in python components import (airbytehq#243) feat(source-declarative-manifest): add support for custom Python components from dynamic text input (airbytehq#174) chore(deps): bump avro from 1.11.3 to 1.12.0 (airbytehq#133) docs: comments on what the `Dockerfile` is for (airbytehq#240) chore: move ruff configuration to dedicated ruff.toml file (airbytehq#237) Fix(sdm): module ref issue in python components import (airbytehq#243) feat(low-code): add DpathFlattenFields (airbytehq#227) feat(source-declarative-manifest): add support for custom Python components from dynamic text input (airbytehq#174) chore(deps): bump avro from 1.11.3 to 1.12.0 (airbytehq#133) docs: comments on what the `Dockerfile` is for (airbytehq#240) chore: move ruff configuration to dedicated ruff.toml file (airbytehq#237)
1 parent 4d95444 commit 9dece24

File tree

81 files changed

+6915
-941
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+6915
-941
lines changed

.github/workflows/connector-tests.yml

Lines changed: 58 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ concurrency:
2525
jobs:
2626
cdk_changes:
2727
name: Get Changes
28-
runs-on: ubuntu-latest
28+
runs-on: ubuntu-22.04
2929
permissions:
3030
statuses: write
3131
pull-requests: read
@@ -62,7 +62,7 @@ jobs:
6262
# Forked PRs are handled by the community_ci.yml workflow
6363
# If the condition is not met the job will be skipped (it will not fail)
6464
# runs-on: connector-test-large
65-
runs-on: ubuntu-latest
65+
runs-on: ubuntu-22.04
6666
timeout-minutes: 360 # 6 hours
6767
strategy:
6868
fail-fast: false
@@ -96,6 +96,8 @@ jobs:
9696
name: "Check: '${{matrix.connector}}' (skip=${{needs.cdk_changes.outputs['src'] == 'false' || needs.cdk_changes.outputs[matrix.cdk_extra] == 'false'}})"
9797
permissions:
9898
checks: write
99+
contents: write # Required for creating commit statuses
100+
pull-requests: read
99101
steps:
100102
- name: Abort if extra not changed (${{matrix.cdk_extra}})
101103
id: no_changes
@@ -123,6 +125,26 @@ jobs:
123125
repository: airbytehq/airbyte
124126
ref: master
125127
path: airbyte
128+
- name: Set up Python
129+
uses: actions/setup-python@v5
130+
with:
131+
python-version: "3.10"
132+
# Create initial pending status for test report
133+
- name: Create Pending Test Report Status
134+
if: steps.no_changes.outputs.status != 'cancelled'
135+
env:
136+
GH_TOKEN: ${{ secrets.GH_PAT_MAINTENANCE_OCTAVIA }}
137+
run: |
138+
HEAD_SHA="${{ github.event.pull_request.head.sha || github.sha }}"
139+
gh api \
140+
--method POST \
141+
-H "Accept: application/vnd.github+json" \
142+
-H "X-GitHub-Api-Version: 2022-11-28" \
143+
repos/${{ github.repository }}/statuses/$HEAD_SHA \
144+
-f state="pending" \
145+
-f description="Running connector tests..." \
146+
-f context="${{ matrix.connector }} Test Report"
147+
126148
- name: Test Connector
127149
if: steps.no_changes.outputs.status != 'cancelled'
128150
timeout-minutes: 90
@@ -131,7 +153,7 @@ jobs:
131153
POETRY_DYNAMIC_VERSIONING_BYPASS: "0.0.0"
132154
run: |
133155
cd airbyte
134-
make tools.airbyte-ci-binary.install
156+
make tools.airbyte-ci-dev.install
135157
airbyte-ci \
136158
--ci-report-bucket-name=airbyte-ci-reports-multi \
137159
connectors \
@@ -169,6 +191,39 @@ jobs:
169191
echo "success=${success}" >> $GITHUB_OUTPUT
170192
echo "html_report_url=${html_report_url}" >> $GITHUB_OUTPUT
171193
194+
# Update the test report status with results
195+
- name: Update Test Report Status
196+
if: always() && steps.no_changes.outputs.status != 'cancelled' && steps.evaluate_output.outcome == 'success'
197+
env:
198+
GH_TOKEN: ${{ secrets.GH_PAT_MAINTENANCE_OCTAVIA }}
199+
run: |
200+
HEAD_SHA="${{ github.event.pull_request.head.sha || github.sha }}"
201+
gh api \
202+
--method POST \
203+
-H "Accept: application/vnd.github+json" \
204+
-H "X-GitHub-Api-Version: 2022-11-28" \
205+
repos/${{ github.repository }}/statuses/$HEAD_SHA \
206+
-f state="${{ steps.evaluate_output.outputs.success == 'true' && 'success' || 'failure' }}" \
207+
-f target_url="${{ steps.evaluate_output.outputs.html_report_url }}" \
208+
-f description="Click Details to view the test report" \
209+
-f context="${{ matrix.connector }} Test Report"
210+
211+
# Create failure status if report generation failed
212+
- name: Create Report Generation Failed Status
213+
if: always() && steps.no_changes.outputs.status != 'cancelled' && steps.evaluate_output.outcome != 'success'
214+
env:
215+
GH_TOKEN: ${{ secrets.GH_PAT_MAINTENANCE_OCTAVIA }}
216+
run: |
217+
HEAD_SHA="${{ github.event.pull_request.head.sha || github.sha }}"
218+
gh api \
219+
--method POST \
220+
-H "Accept: application/vnd.github+json" \
221+
-H "X-GitHub-Api-Version: 2022-11-28" \
222+
repos/${{ github.repository }}/statuses/$HEAD_SHA \
223+
-f state="failure" \
224+
-f description="Failed to run connector tests." \
225+
-f context="${{ matrix.connector }} Test Report"
226+
172227
# Upload the job output to the artifacts
173228
- name: Upload Job Output
174229
id: upload_job_output

.github/workflows/pdoc_preview.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88

99
jobs:
1010
preview_docs:
11-
runs-on: ubuntu-latest
11+
runs-on: ubuntu-24.04
1212

1313
steps:
1414
- name: Checkout code

.github/workflows/pdoc_publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ concurrency:
2222

2323
jobs:
2424
publish_docs:
25-
runs-on: ubuntu-latest
25+
runs-on: ubuntu-24.04
2626
environment:
2727
name: "github-pages"
2828
url: ${{ steps.deployment.outputs.page_url }}

.github/workflows/pypi_publish.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ on:
3535
jobs:
3636
build:
3737
name: Build Python Package
38-
runs-on: ubuntu-latest
38+
runs-on: ubuntu-24.04
3939
steps:
4040
- name: Detect Release Tag Version
4141
if: startsWith(github.ref, 'refs/tags/v')
@@ -107,7 +107,7 @@ jobs:
107107

108108
publish_cdk:
109109
name: Publish CDK version to PyPI
110-
runs-on: ubuntu-latest
110+
runs-on: ubuntu-24.04
111111
needs: [build]
112112
permissions:
113113
id-token: write
@@ -156,7 +156,7 @@ jobs:
156156
(github.event_name == 'workflow_dispatch' &&
157157
github.event.inputs.publish_to_dockerhub == 'true'
158158
)
159-
runs-on: ubuntu-latest
159+
runs-on: ubuntu-24.04
160160
needs: [build]
161161
environment:
162162
name: DockerHub
@@ -257,7 +257,7 @@ jobs:
257257
env:
258258
VERSION: ${{ needs.build.outputs.VERSION }}
259259
IS_PRERELEASE: ${{ needs.build.outputs.IS_PRERELEASE }}
260-
runs-on: ubuntu-latest
260+
runs-on: ubuntu-24.04
261261
steps:
262262
- uses: actions/setup-python@v5
263263
with:

.github/workflows/pytest_fast.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99
jobs:
1010
test-build:
1111
name: Build and Inspect Python Package
12-
runs-on: ubuntu-latest
12+
runs-on: ubuntu-24.04
1313
steps:
1414
- name: Checkout code
1515
uses: actions/checkout@v4
@@ -36,7 +36,7 @@ jobs:
3636
3737
pytest-fast:
3838
name: Pytest (Fast)
39-
runs-on: ubuntu-latest
39+
runs-on: ubuntu-24.04
4040
steps:
4141
# Common steps:
4242
- name: Checkout code

.github/workflows/python_lint.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99
jobs:
1010
ruff-lint-check:
1111
name: Ruff Lint Check
12-
runs-on: ubuntu-latest
12+
runs-on: ubuntu-24.04
1313
steps:
1414
# Common steps:
1515
- name: Checkout code
@@ -32,7 +32,7 @@ jobs:
3232

3333
ruff-format-check:
3434
name: Ruff Format Check
35-
runs-on: ubuntu-latest
35+
runs-on: ubuntu-24.04
3636
steps:
3737
# Common steps:
3838
- name: Checkout code
@@ -55,7 +55,7 @@ jobs:
5555

5656
mypy-check:
5757
name: MyPy Check
58-
runs-on: ubuntu-latest
58+
runs-on: ubuntu-24.04
5959
steps:
6060
# Common steps:
6161
- name: Checkout code

.github/workflows/release_drafter.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
permissions:
1717
contents: write
1818
pull-requests: write
19-
runs-on: ubuntu-latest
19+
runs-on: ubuntu-24.04
2020
steps:
2121
# Drafts the next Release notes as Pull Requests are merged into "main"
2222
- uses: release-drafter/release-drafter@v6

.github/workflows/semantic_pr_check.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ permissions:
1414
jobs:
1515
validate_pr_title:
1616
name: Validate PR title
17-
runs-on: ubuntu-latest
17+
runs-on: ubuntu-24.04
1818
steps:
1919
- uses: amannn/action-semantic-pull-request@v5
2020
if: ${{ github.event.pull_request.draft == false }}

.github/workflows/slash_command_dispatch.yml

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,13 @@ jobs:
88
slashCommandDispatch:
99
# Only allow slash commands on pull request (not on issues)
1010
if: ${{ github.event.issue.pull_request }}
11-
runs-on: ubuntu-latest
11+
runs-on: ubuntu-24.04
1212
steps:
1313
- name: Slash Command Dispatch
1414
id: dispatch
15-
uses: peter-evans/slash-command-dispatch@v4
15+
# TODO: Revert to `peter-evans/slash-command-dispatch@v4` after PR merges:
16+
# - https://github.com/peter-evans/slash-command-dispatch/pull/372/files
17+
uses: aaronsteers/slash-command-dispatch@aj/fix/add-dispatched-bool-output
1618
with:
1719
repository: ${{ github.repository }}
1820
token: ${{ secrets.GH_PAT_MAINTENANCE_OCTAVIA }}
@@ -36,3 +38,33 @@ jobs:
3638
comment-id: ${{ github.event.comment.id }}
3739
body: |
3840
> Error: ${{ steps.dispatch.outputs.error-message }}
41+
42+
- name: Generate help text
43+
id: help
44+
if: >
45+
startsWith(github.event.comment.body, '/') &&
46+
!steps.dispatch.outputs.dispatched
47+
run: |
48+
HELP_TEXT="The following slash commands are available:
49+
50+
- \`/autofix\` - Corrects any linting or formatting issues
51+
- \`/test\` - Runs the test suite
52+
- \`/poetry-lock\` - Re-locks dependencies and updates the poetry.lock file
53+
- \`/help\` - Shows this help message"
54+
55+
if [[ "${{ github.event.comment.body }}" == "/help" ]]; then
56+
echo "body=$HELP_TEXT" >> $GITHUB_OUTPUT
57+
else
58+
echo "body=It looks like you are trying to enter a slash command. Either the slash command is unrecognized or you don't have access to call it.
59+
60+
$HELP_TEXT" >> $GITHUB_OUTPUT
61+
fi
62+
63+
- name: Post help message
64+
if: >
65+
startsWith(github.event.comment.body, '/') &&
66+
!steps.dispatch.outputs.dispatched
67+
uses: peter-evans/create-or-update-comment@v4
68+
with:
69+
comment-id: ${{ github.event.comment.id }}
70+
body: ${{ steps.help.outputs.body }}

.github/workflows/test-command.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ on:
1515
jobs:
1616
start-workflow:
1717
name: Append 'Starting' Comment
18-
runs-on: ubuntu-latest
18+
runs-on: ubuntu-24.04
1919
steps:
2020
- name: Get PR JSON
2121
id: pr-info
@@ -127,7 +127,7 @@ jobs:
127127
log-success-comment:
128128
name: Append 'Success' Comment
129129
needs: [pytest-on-demand]
130-
runs-on: ubuntu-latest
130+
runs-on: ubuntu-24.04
131131
steps:
132132
- name: Append success comment
133133
uses: peter-evans/create-or-update-comment@v4
@@ -143,7 +143,7 @@ jobs:
143143
# This job will only run if the workflow fails
144144
needs: [pytest-on-demand, start-workflow]
145145
if: always() && needs.pytest-on-demand.result == 'failure'
146-
runs-on: ubuntu-latest
146+
runs-on: ubuntu-24.04
147147
steps:
148148
- name: Append failure comment
149149
uses: peter-evans/create-or-update-comment@v4

Dockerfile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
# This Dockerfile is used to build `airbyte/source-declarative-manifest` image that in turn is used
2+
# 1. to build Manifest-only connectors themselves
3+
# 2. to run manifest (Builder) connectors published into a particular user's workspace in Airbyte
4+
#
5+
# A new version of source-declarative-manifest is built for every new Airbyte CDK release, and their versions are kept in sync.
6+
#
7+
18
FROM docker.io/airbyte/python-connector-base:3.0.0@sha256:1a0845ff2b30eafa793c6eee4e8f4283c2e52e1bbd44eed6cb9e9abd5d34d844
29

310
WORKDIR /airbyte/integration_code

airbyte_cdk/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@
9292
from .sources.declarative.declarative_stream import DeclarativeStream
9393
from .sources.declarative.decoders import Decoder, JsonDecoder
9494
from .sources.declarative.exceptions import ReadException
95-
from .sources.declarative.extractors import DpathExtractor, RecordSelector
95+
from .sources.declarative.extractors import DpathEnhancingExtractor, DpathExtractor, RecordSelector
9696
from .sources.declarative.extractors.record_extractor import RecordExtractor
9797
from .sources.declarative.extractors.record_filter import RecordFilter
9898
from .sources.declarative.incremental import DatetimeBasedCursor
@@ -234,6 +234,7 @@
234234
"DefaultPaginator",
235235
"DefaultRequestOptionsProvider",
236236
"DpathExtractor",
237+
"DpathEnhancingExtractor",
237238
"FieldPointer",
238239
"HttpMethod",
239240
"HttpRequester",

airbyte_cdk/cli/source_declarative_manifest/_run.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,12 @@ def create_declarative_source(
171171
"Invalid config: `__injected_declarative_manifest` should be provided at the root "
172172
f"of the config but config only has keys: {list(config.keys() if config else [])}"
173173
)
174+
if not isinstance(config["__injected_declarative_manifest"], dict):
175+
raise ValueError(
176+
"Invalid config: `__injected_declarative_manifest` should be a dictionary, "
177+
f"but got type: {type(config['__injected_declarative_manifest'])}"
178+
)
179+
174180
return ConcurrentDeclarativeSource(
175181
config=config,
176182
catalog=catalog,

airbyte_cdk/connector_builder/connector_builder_handler.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ def get_limits(config: Mapping[str, Any]) -> TestReadLimits:
5252
def create_source(config: Mapping[str, Any], limits: TestReadLimits) -> ManifestDeclarativeSource:
5353
manifest = config["__injected_declarative_manifest"]
5454
return ManifestDeclarativeSource(
55+
config=config,
5556
emit_connector_builder_messages=True,
5657
source_config=manifest,
5758
component_factory=ModelToComponentFactory(

0 commit comments

Comments
 (0)