Skip to content

Use oracledb AuthMode/Purity enums in Oracle hook connection config#67689

Merged
potiuk merged 2 commits into
apache:mainfrom
ed-kyu:feature/oracle-auth-mode-purity-enum
Jul 1, 2026
Merged

Use oracledb AuthMode/Purity enums in Oracle hook connection config#67689
potiuk merged 2 commits into
apache:mainfrom
ed-kyu:feature/oracle-auth-mode-purity-enum

Conversation

@ed-kyu

@ed-kyu ed-kyu commented May 29, 2026

Copy link
Copy Markdown
Contributor

Description

Resolves the long-standing TODO in OracleHook.get_conn to map the connection extra mode/purity strings via the oracledb.AuthMode and oracledb.Purity enums, replacing the hand-written if/elif chains.

Key changes

  • Enum mapping: the connection extra mode/purity string is now resolved against the matching AuthMode/Purity enum member by name (case-insensitive), collapsing two if/elif chains into a single getattr lookup each.
  • Minimum bump: oracledb.AuthMode/oracledb.Purity were introduced in python-oracledb 2.3, so the floor is raised from 2.0.0 to 2.3.0 (a minor release within the same major).
  • Wider coverage: matching now covers every AuthMode/Purity value instead of the previously hard-coded subset.

Compatibility

The legacy AUTH_MODE_* / PURITY_* module constants are aliases of these enum members, so resolved connection values are unchanged. None is compared explicitly because Purity.DEFAULT is 0 and a truthiness check would drop it.

If raising the oracledb floor is undesirable, the same de-duplication can be achieved without a bump via getattr(oracledb, f"AUTH_MODE_{name}") on the legacy constants — happy to switch if preferred.

Verification

  • prek (ruff, pre-commit hooks): passed
  • Existing test_get_conn_mode / test_get_conn_purity and the full test_oracle.py hook suite (55 tests): passed unchanged

Was generative AI tooling used to co-author this PR?
  • Yes

Generated-by: Claude Code (Opus 4.8) following the guidelines


  • Read the Pull Request Guidelines for more information. Note: commit author/co-author name and email in commits become permanently public when merged.
  • For fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
  • When adding dependency, check compliance with the ASF 3rd Party License Policy.
  • For significant user-facing changes create newsfragment: {pr_number}.significant.rst, in airflow-core/newsfragments. You can add this file in a follow-up commit after the PR is created so you know the PR number.

@ed-kyu

ed-kyu commented Jun 1, 2026

Copy link
Copy Markdown
Contributor Author

Hi @potiuk @amoghrajesh — when you have a moment, could you take a look at this PR? It's a small change that switches the Oracle hook to use oracledb's AuthMode/Purity enums instead of raw integers. Thanks!

@potiuk potiuk added the ready for maintainer review Set after triaging when all criteria pass. label Jun 1, 2026
ed-kyu added 2 commits June 21, 2026 19:46
Resolve the long-standing TODO to map the connection extra mode/purity
strings via the oracledb.AuthMode / oracledb.Purity enums instead of the
hand-written if/elif chains. The enums were added in python-oracledb 2.3,
so the minimum is raised from 2.0.0 to 2.3.0.

The legacy AUTH_MODE_*/PURITY_* module constants are aliases of these enum
members, so the resolved values are unchanged. Matching is now done by enum
member name (case-insensitive) and covers every AuthMode/Purity value rather
than the previously hard-coded subset. None is compared explicitly because
Purity.DEFAULT is 0 and a truthiness check would drop it.
The dependency table in the generated README.rst and docs/index.rst is
derived from pyproject.toml. Regenerated via
`breeze release-management prepare-provider-documentation --only-min-version-update`
to reflect the oracledb >=2.3.0 floor.
@potiuk
potiuk force-pushed the feature/oracle-auth-mode-purity-enum branch from 3b3071f to dc6c0e3 Compare June 21, 2026 23:46
@potiuk
potiuk merged commit 3daa88e into apache:main Jul 1, 2026
93 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants