Skip to content

Add IBM Db2 provider with Hook - #67532

Merged
dabla merged 9 commits into
apache:mainfrom
Amitkumar293:airflow-db2-adapter
Aug 23, 2026
Merged

Add IBM Db2 provider with Hook #67532
dabla merged 9 commits into
apache:mainfrom
Amitkumar293:airflow-db2-adapter

Conversation

@Amitkumar293

@Amitkumar293 Amitkumar293 commented May 26, 2026

Copy link
Copy Markdown
Contributor

Description

This PR adds a new provider for IBM Db2 database support in Apache Airflow.

What: New Db2 provider package with Hook and Operator
Why: Enable Airflow users to connect to and execute queries against IBM Db2 databases

Changes

  • Db2Hook: Extends DbApiHook for IBM Db2 connectivity with SSL support
  • Added Db2Dialect: - Mentioned the SQLAlchemy dialect component
  • Comprehensive unit tests (Tests covering all functionality)
  • Documentation and example DAGs
  • Provider metadata and configuration

Testing

  • ✅ All unit tests passing
  • ✅ Ruff linting and formatting checks passed
  • ✅ Follows Airflow coding standards

Important

🛠️ Maintainer triage note for @Amitkumar293 · by @potiuk · 2026-07-28 16:22 UTC

Helpful heads-up from the maintainers — please address before this PR can be reviewed:

  • Pre-commit / static checks. See docs.

The ball is in your court — you've been assigned to this PR. Fix the above, then mark it Ready for review.

See the Pull Request quality criteria for how to fix each item. There is no rush.

Automated triage — may be imperfect; a maintainer takes the next look. We use this two-stage triage process so maintainers' limited time goes to the conversation with you.

@boring-cyborg

boring-cyborg Bot commented May 26, 2026

Copy link
Copy Markdown

Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contributors' Guide
Here are some useful points:

  • Pay attention to the quality of your code (ruff, mypy and type annotations). Our prek-hooks will help you with that.
  • In case of a new feature add useful documentation (in docstrings or in docs/ directory). Adding a new operator? Check this short guide Consider adding an example Dag that shows how users should use it.
  • Consider using Breeze environment for testing locally, it's a heavy docker but it ships with a working Airflow and a lot of integrations.
  • Be patient and persistent. It might take some time to get a review or get the final approval from Committers.
  • Please follow ASF Code of Conduct for all communication including (but not limited to) comments on Pull Requests, Mailing list and Slack.
  • Be sure to read the Airflow Coding style.
  • Always keep your Pull Requests rebased, otherwise your build might fail due to changes not related to your commits.
    Apache Airflow is a community-driven project and together we are making it better 🚀.
    In case of doubts contact the developers at:
    Mailing List: dev@airflow.apache.org
    Slack: https://s.apache.org/airflow-slack

@Amitkumar293
Amitkumar293 marked this pull request as ready for review May 27, 2026 05:59
Comment thread .github/boring-cyborg.yml Outdated
@jscheffl

Copy link
Copy Markdown
Contributor

Note, that some fomality with announcement/DISCUSS is neede to add a new provider, following https://github.com/apache/airflow/blob/main/providers/ACCEPTING_PROVIDERS.rst

@Amitkumar293

Copy link
Copy Markdown
Contributor Author

Note, that some fomality with announcement/DISCUSS is neede to add a new provider, following https://github.com/apache/airflow/blob/main/providers/ACCEPTING_PROVIDERS.rst

Thanks for pointing this out.

I’ve created a DISCUSS thread on the dev@airflow.apache.org mailing list for the new IBM Db2 provider, following the ACCEPTING_PROVIDERS.rst process.

Comment thread providers/ibm/db2/src/airflow/providers/ibm/db2/hooks/__init__.py
@github-actions

github-actions Bot commented May 28, 2026

Copy link
Copy Markdown
Contributor

uv.lock on main just moved via #71924 ("[main] Upgrade important CI environment"), commit 4a247b9 and this PR currently conflicts.

Quickest fix:

git fetch upstream main && git rebase upstream/main
rm uv.lock && uv lock
git add uv.lock && git rebase --continue
git push --force-with-lease

Automated nudge — ignore if you're not ready to rebase. This comment is updated in place on future uv.lock bumps.

@Amitkumar293
Amitkumar293 force-pushed the airflow-db2-adapter branch from 5d470ba to 7b1633e Compare June 1, 2026 10:03
Comment thread scripts/ci/docker-compose/tests-sources.yml Outdated
Comment thread providers/ibm/db2/docs/commits.rst Outdated
Comment thread providers/ibm/db2/docs/example-dags.rst
Comment thread providers/ibm/db2/docs/installing-providers-from-sources.rst Outdated
Comment thread providers/ibm/db2/docs/security.rst Outdated
Comment thread providers/ibm/db2/src/airflow/providers/ibm/db2/operators/db2.py Outdated
Comment thread providers/ibm/db2/provider.yaml Outdated
@Amitkumar293

Copy link
Copy Markdown
Contributor Author

@jscheffl Thanks for your review, very helpful. I am working on the review comments.

@eladkal

eladkal commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

Was there a mailing list thread about this new provider?
https://github.com/apache/airflow/blob/main/providers/ACCEPTING_PROVIDERS.rst#examples-of-current-process

@Amitkumar293

Copy link
Copy Markdown
Contributor Author

Thank you David.

@dabla

dabla commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Provider is looking good now, thanks for the work and changes.

I think you should start a vote now for this provider on the Apache Airflow devlist if the provider was already proposed there, if not you should start a proposal first before starting a vote.

https://lists.apache.org/list.html?dev@airflow.apache.org

Once the provider has been approved, then we can merge.

@Amitkumar293

Copy link
Copy Markdown
Contributor Author

Provider is looking good now, thanks for the work and changes.

I think you should start a vote now for this provider on the Apache Airflow devlist if the provider was already proposed there, if not you should start a proposal first before starting a vote.

https://lists.apache.org/list.html?dev@airflow.apache.org

Once the provider has been approved, then we can merge.

Provider is looking good now, thanks for the work and changes.

I think you should start a vote now for this provider on the Apache Airflow devlist if the provider was already proposed there, if not you should start a proposal first before starting a vote.

https://lists.apache.org/list.html?dev@airflow.apache.org

Once the provider has been approved, then we can merge.

Hi David,
I sent the discussion email last week, but it is not appearing in the dev mailing list.

@dabla

dabla commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Provider is looking good now, thanks for the work and changes.
I think you should start a vote now for this provider on the Apache Airflow devlist if the provider was already proposed there, if not you should start a proposal first before starting a vote.
https://lists.apache.org/list.html?dev@airflow.apache.org
Once the provider has been approved, then we can merge.

Provider is looking good now, thanks for the work and changes.
I think you should start a vote now for this provider on the Apache Airflow devlist if the provider was already proposed there, if not you should start a proposal first before starting a vote.
https://lists.apache.org/list.html?dev@airflow.apache.org
Once the provider has been approved, then we can merge.

Hi David, I sent the discussion email last week, but it is not appearing in the dev mailing list.

Check the link here to register to the devlist:

https://airflow.apache.org/community/

Also check the static checks errors and resolve conflicts.

@Amitkumar293
Amitkumar293 force-pushed the airflow-db2-adapter branch 2 times, most recently from 4a62428 to 90dd18e Compare August 13, 2026 07:40
Comment thread providers/ibm/db2/src/airflow/providers/ibm/db2/hooks/db2.py Outdated
Comment thread providers/ibm/db2/src/airflow/providers/ibm/db2/dialects/db2.py Outdated

@dabla dabla left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR #67532 Review — New IBM Db2 Provider

🔴 Major

1. Db2Dialect.get_column_names() — positional predicate argument causes TypeError
providers/ibm/db2/src/airflow/providers/ibm/db2/dialects/db2.py:29–34

The author's intent is correct: always exclude autoincrement/identity columns by hardcoding the predicate. However, the base Dialect.get_target_fields() passes the predicate as a positional third argument:

self.get_column_names(
    table,
    schema,
    lambda column: not column.get("identity", False) and not column.get("autoincrement", False),
)

The override signature is (self, table, schema, **kwargs). Since **kwargs only captures keyword arguments, the positional lambda has no matching parameter and raises TypeError at runtime. The fix is to accept predicate by name and ignore it:

def get_column_names(self, table: str, schema: str | None = None, predicate=None, **kwargs) -> list[str] | None:
    return super().get_column_names(
        table, schema,
        predicate=lambda col: not col.get("autoincrement", False),
    )

2. SQL placeholder style mismatch
providers/ibm/db2/README.rst:74–91 vs hooks/db2.py:54
The hook declares qmark style (?), but the README examples use %s / %(dept)s (pyformat). Those examples won't run as-is.

3. Connection doc contradicts hook implementation
providers/ibm/db2/docs/connections/db2.rst:31–60
The doc pushes database/protocol/security into extras, but the hook reads them from named connection fields (hooks/db2.py:68–73, 87–109). This will lead to silent misconfiguration.


🟡 Minor

4. System test uses wrong kwarg name
tests/system/ibm/db2/example_db2.py:55, 99, 137, 166
The hook is instantiated with conn_id=... but the correct kwarg is db2_conn_id. It works only because the default ID matches; a custom ID would be silently ignored.

5. SSL config naming inconsistency
providers/ibm/db2/README.rst:59–62 vs hooks/db2.py:35–41
README documents ssl/sslcert; the hook and provider metadata use
SECURITY/SSLServerCertificate. The user-facing contract is inconsistent.


✅ What looks good

  • License headers present on all new files
  • No AirflowException raised directly
  • No time.time() used for duration logic
  • Commit messages follow Airflow conventions (no Conventional Commits prefixes)
  • Provider scaffold is complete: hook, dialect, provider.yaml, pyproject.toml,
    connection doc, changelog, system example

Top priorities before merge: fix #1 (runtime crash on any upsert/insert with
target-field resolution) and #3 (misleads users into broken connections).


Drafted-by: Claude Sonnet 4.6 (no human review before posting)
Reviewed by @dabla

@Amitkumar293
Amitkumar293 requested a review from dabla August 22, 2026 01:55
@dabla
dabla merged commit 8162cd3 into apache:main Aug 23, 2026
305 of 306 checks passed
@boring-cyborg

boring-cyborg Bot commented Aug 23, 2026

Copy link
Copy Markdown

Awesome work, congrats on your first merged pull request! You are invited to check our Issue Tracker for additional contributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants