Skip to content

Add Oracle Cloud provider and Generative AI hook - #70160

Draft
AlejandroMorgante wants to merge 1 commit into
apache:mainfrom
AlejandroMorgante:add-oci-generative-ai-hook
Draft

AlejandroMorgante wants to merge 1 commit into
apache:mainfrom
AlejandroMorgante:add-oci-generative-ai-hook

Conversation

@AlejandroMorgante

@AlejandroMorgante AlejandroMorgante commented Jul 21, 2026 •

Copy link
Copy Markdown
Contributor

Adds Oracle Cloud Infrastructure authentication and a Generative AI management hook as an independent oraclecloud provider. Users install apache-airflow-providers-oraclecloud[oci] and import hooks from airflow.providers.oraclecloud.

This draft proposes a separate namespace so Oracle Cloud can be introduced without migrating the existing Oracle Database provider in #71325. Database keeps its package, imports, and oracle connection type. The proposed naming still needs maintainer agreement; this contribution does not include or commit to a future namespace migration.

Scope

  • Adds OciBaseHook with API-key, OCI configuration-file, instance-principal, and resource-principal authentication, native client construction, connection testing, compartment resolution, and client caching.
  • Adds OciGenerativeAIHook, exposing the native OCI GenerativeAiClient for Hosted Application, Hosted Deployment, and work-request operations.
  • Registers the oracle_cloud connection type, with default connection ID oracle_cloud_default.
  • Adds provider metadata, connection UI metadata, documentation, unit tests, and a read-only system Dag.

The OCI SDK remains an optional oci extra. Custom endpoints and worker-local credential files are explicit hook arguments controlled by Dag authors; Connection-supplied regions are validated as OCI region identifiers. Users who only install the provider can import its hook modules without the SDK and receive an installation instruction when attempting to use OCI features.

Validation

  • Provider metadata and documentation regenerated using the normal Breeze workflow; workspace lockfile regenerated successfully.
  • 36 provider unit tests passed in Breeze with Python 3.11 and SQLite.
  • Built real Oracle Database 4.7.1 and Oracle Cloud 0.1.0 wheels and tested four clean-environment combinations: pip and uv, with each installation order. Verified both hook imports and connection registrations, hook imports and actionable errors without the optional OCI SDK, SDK-enabled client-class loading, and that uninstalling either provider leaves the other usable. These checks used Airflow 3.3.2 and Python 3.11.
  • Provider documentation, including spelling checks, built successfully with breeze build-docs --answer no oraclecloud.
  • Fast static checks passed with check-provider-yaml-valid executed separately through its official Breeze script after installing the new provider. Provider mypy passed.

Unit-test command used with the existing local Breeze image:

breeze run --skip-image-upgrade-check --answer yes --backend sqlite bash -c \
  'uv pip install --no-deps -e providers/oraclecloud && uv pip install "oci>=2.182.0" fastapi==0.161.0 starlette==1.8.0 && pytest providers/oraclecloud/tests/unit/oraclecloud -q -x'

Local verification limitations: rebuilding the CI image failed because of conflicting Debian/DHI system packages. The manual upgrade-dependency-floors hook failed with an IndexError during rollback; no existing dependency floors were changed. The full repository-wide test matrix selected by breeze verify for workspace/lockfile changes was not run locally.

No live OCI system test is claimed for this update.

Provider adoption

The new-provider process remains pending, including the dev-list announcement, stewards, sponsoring committer, continuous validation plan, and discussion period. The provider remains not-ready and in incubation.

Connection UI

This PR introduces a new Connection type.

Oracle Cloud Infrastructure connection form
Was generative AI tooling used to co-author this PR?
  • Yes — Codex (GPT-5 and GPT-6)

Generated-by: Codex (GPT-5 and GPT-6) following the guidelines

@AlejandroMorgante
AlejandroMorgante force-pushed the add-oci-generative-ai-hook branch from 0bbd204 to 7bf3b0a Compare July 21, 2026 04:32
@AlejandroMorgante AlejandroMorgante changed the title Add Oracle Cloud Infraestructure (OCI) connection and Generative AI hook Add Oracle Cloud Infrastructure (OCI) connection and Generative AI hook Jul 21, 2026
@AlejandroMorgante
AlejandroMorgante force-pushed the add-oci-generative-ai-hook branch 3 times, most recently from fcfba4b to f97ea8c Compare July 21, 2026 15:28
@AlejandroMorgante

Copy link
Copy Markdown
Contributor Author

@SameerMesiah97 Could you please help me with a review? Thanks!

@shahar1 shahar1 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.

Reviewed using AI assistance (Apache Magpie), I went over the comments before posting

Comment thread providers/oracle/provider.yaml Resolved

@SameerMesiah97 SameerMesiah97 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.

Looks very clean overall. I have left some comments.

Comment thread providers/oracle/docs/generative_ai.rst Resolved
Comment thread providers/oracle/docs/generative_ai.rst Resolved
@AlejandroMorgante
AlejandroMorgante force-pushed the add-oci-generative-ai-hook branch from 2238b37 to 8c50b5d Compare July 25, 2026 23:47
@AlejandroMorgante
AlejandroMorgante force-pushed the add-oci-generative-ai-hook branch 3 times, most recently from c96e90e to a5d5a71 Compare July 26, 2026 06:40
@potiuk potiuk added the ready for maintainer review Set by triage when all criteria pass, or by the fork CI reconciler when fork CI is green. label Jul 28, 2026

@SameerMesiah97 SameerMesiah97 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.

Looks good.

@shahar1 shahar1 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.

Thanks for the thorough follow-up — all points from my previous review are addressed, and the security-boundary design (connection extras can't steer key_file/config_file/service_endpoint) plus the placeholder-sync test are genuinely nice. One packaging issue is blocking, one smaller bug inline.

Blocking — common-compat minimum bound too low (pyproject.toml:63)

The hooks import BaseHook, AirflowNotFoundException, and AirflowOptionalProviderFeatureException from airflow.providers.common.compat.sdk. That module only exists since apache-airflow-providers-common-compat 1.10.0, and exports these three symbols only since 1.12.0 — but the bound here stays >=1.8.0. On an environment with compat 1.8–1.11, import airflow.providers.oracle.hooks.base_oci fails with ImportError even though pip considers the environment consistent. Please bump to >=1.12.0. The # use next version marker is used when the required version isn't released yet — 1.12.0 (and 1.17.0) already are, so the marker should be dropped.

get_compartment_id() breaks for principal auth without a connection (base_oci.py:235)

self.connection.extra_dejson is read directly, so with oci_conn_id=None (instance/resource principal) this raises the misleading ValueError: An OCI connection ID is required for API key authentication., and with a missing connection row it leaks AirflowNotFoundException instead of the intended compartment error. The docs tell principal-auth users to call this method. Reusing _get_optional_connection_extras() fixes both paths — plus a small test for the no-connection case.

Smaller observations

  • tests/.../test_base_oci.py:38 — the module-level pytest.importorskip("oci.generative_ai") also skips the two tests whose purpose is missing-SDK behaviour (test_get_oci_sdk_requires_optional_extra, test_hook_modules_import_without_optional_oci_sdk) when oci isn't installed. Consider hosting those two in a module without the skip. Not blocking.

This review was drafted by an AI-assisted tool and confirmed by an Apache Airflow maintainer. After you've addressed the points above and pushed an update, an Apache Airflow maintainer — a real person — will take the next look at the PR. The findings cite the project's review criteria; if you think one of them is mis-applied, please reply on the PR and a maintainer will weigh in.

More on how Apache Airflow handles maintainer review: contributing-docs/05_pull_requests.rst.


Drafted-by: Claude Code (Fable 5); reviewed by @shahar1 before posting

Comment thread providers/oracle/pyproject.toml Resolved

@shahar1 shahar1 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.

Good to go once common-compat version is settled

@AlejandroMorgante
AlejandroMorgante force-pushed the add-oci-generative-ai-hook branch from d507fb0 to 9435c10 Compare August 1, 2026 19:10
@vikramkoka

Copy link
Copy Markdown
Contributor

I am fully supportive of this work.

However, don't you think it is better to put this into a new OCI (Oracle Cloud Infra) provider?
Rather than putting it into the Oracle DB provider?

cc: @eladkal @kaxil @potiuk @ashb

@AlejandroMorgante

AlejandroMorgante commented Aug 5, 2026 •

Copy link
Copy Markdown
Contributor Author

Good point — I agree that OCI should be a separate provider, similar to microsoft.azure and microsoft.mssql. I suggest using oci as the provider ID. The alternatives oracle.cloud and oracle.oci would require restructuring the existing oracle provider, since oracle is already a provider rather than an umbrella namespace. We can still use “Oracle Cloud Infrastructure” as the public-facing name for clarity.

  • Display name: Oracle Cloud Infrastructure (OCI)
  • Provider ID: oci
  • Package: apache-airflow-providers-oci
  • Namespace: airflow.providers.oci

@AlejandroMorgante
AlejandroMorgante force-pushed the add-oci-generative-ai-hook branch from 9435c10 to 52fae43 Compare August 6, 2026 01:45
@AlejandroMorgante
AlejandroMorgante marked this pull request as draft August 6, 2026 02:07
@AlejandroMorgante
AlejandroMorgante force-pushed the add-oci-generative-ai-hook branch from 52fae43 to ae16b25 Compare August 6, 2026 03:21
@AlejandroMorgante
AlejandroMorgante marked this pull request as ready for review August 6, 2026 03:31
@AlejandroMorgante AlejandroMorgante changed the title Add Oracle Cloud Infrastructure (OCI) connection and Generative AI hook Add Oracle Cloud Infrastructure provider and Generative AI hook Aug 6, 2026
@AlejandroMorgante
AlejandroMorgante force-pushed the add-oci-generative-ai-hook branch from da3895e to e9010f2 Compare August 6, 2026 12:58
@eladkal

eladkal commented Aug 6, 2026 •

Copy link
Copy Markdown
Contributor

I think I am leaning towards
apache-airflow-providers-oracle-cloud (OCI can sit within the cloud provider)
apache-airflow-providers-oracle-db (To have what we currently have in apache-airflow-providers-oracle)

and possible discontinue apache-airflow-providers-oracle or handle it as an empty shell that install all oracle related packages?

Migrating a provider name is something we did in the past with apache-airflow-providers-jira -> apache-airflow-providers-atlassian-jira (We did it with steps to avoid breaking changes)

@vikramkoka

Copy link
Copy Markdown
Contributor

I think I am leaning towards apache-airflow-providers-oracle-cloud (OCI can sit within the cloud provider) apache-airflow-providers-oracle-db (To have what we currently have in apache-airflow-providers-oracle)

and possible discontinue apache-airflow-providers-oracle or handle it as an empty shell that install all oracle related packages?

Migrating a provider name is something we did in the past with apache-airflow-providers-jira -> apache-airflow-providers-atlassian-jira (We did it with steps to avoid breaking changes)

no issues with naming.
But, I still think the oracle-cloud provider should have a quick dev list email and go into "incubation"

@kaxil

kaxil commented Aug 7, 2026

Copy link
Copy Markdown
Member

Agreed with Elad on apache-airflow-providers-oracle-cloud -- OCI can easily be confused with https://opencontainers.org/

@eladkal

eladkal commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

But, I still think the oracle-cloud provider should have a quick dev list email and go into "incubation"

It should follow the procedure of adding a new provider yes. I think we just need to figure out the mechanism here and how we phase out the oracle provider infavor of oracle-db and oracle-cloud

@eladkal eladkal 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.

Temp block till we alligned on the setup of the oracle folder structure

@eladkal

eladkal commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

cc @kaxil @vikramkoka @AlejandroMorgante I started the first step of the migration #71325

I think it would be better to solve oracle -> oracle-oracledb migration and only after all steps are finished introduce oracle-oci The plan is explained in #71325

@github-actions

Copy link
Copy Markdown
Contributor

uv.lock on main just moved via #71186 ("Adopt flit 4 as the provider distribution build backend"), commit 9b4be7f 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.

@potiuk

potiuk commented Aug 12, 2026

Copy link
Copy Markdown
Member

Agreeing with where this landed: apache-airflow-providers-oracle-cloud rather than oci, and after #71325 rather than before it.

The sequencing matters more than it may look. #71325 turns oracle into an umbrella namespace (providers/oracle/oracledb/), which is what makes room for this provider to live at providers/oracle/cloud/ as airflow.providers.oracle.cloud. Landing it now as a top-level providers/oci/ would mean moving every module, the package name, the connection type and the docs a second time, and users would be asked to migrate twice.

Concretely, what this PR needs before it can be reviewed for merge:

  • wait for Migrate oracle provider to oracle-oracledb #71325 to land, then re-target to providers/oracle/cloud/ with the package name apache-airflow-providers-oracle-cloud and module path airflow.providers.oracle.cloud;
  • follow the new-provider procedure, including the announcement on the dev list — a new provider is a project-level commitment, not only a code review;
  • rebase to resolve the current uv.lock conflict from the flit-4 change on main.

None of this is a comment on the code. The hook layer reads well — the auth types are enumerated, the OCI SDK import is guarded behind AirflowOptionalProviderFeatureException, and the connection form is properly specified. It is worth converting the PR to draft while it waits, so it drops out of the maintainer review queue and nobody re-reviews it in the interim.


Drafted-by: Claude Code (Opus 5); reviewed by @potiuk before posting

@AlejandroMorgante
AlejandroMorgante marked this pull request as draft August 12, 2026 18:24
@github-actions

Copy link
Copy Markdown
Contributor

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 5 days if no further activity occurs. Thank you for your contributions.

@github-actions github-actions Bot added the stale Stale PRs per the .github/workflows/stale.yml policy file label Oct 28, 2026
@AlejandroMorgante
AlejandroMorgante marked this pull request as ready for review October 28, 2026 17:21
@AlejandroMorgante
AlejandroMorgante marked this pull request as draft October 28, 2026 17:21
@shahar1 shahar1 removed the stale Stale PRs per the .github/workflows/stale.yml policy file label Oct 28, 2026
@AlejandroMorgante
AlejandroMorgante force-pushed the add-oci-generative-ai-hook branch from e9010f2 to 21d237f Compare October 28, 2026 19:27
@AlejandroMorgante AlejandroMorgante changed the title Add Oracle Cloud Infrastructure provider and Generative AI hook Add Oracle Cloud provider and Generative AI hook Oct 28, 2026
Oracle Cloud integrations should be available without relocating the existing
Oracle Database provider or making its users adopt a different package.
An independent namespace keeps that contribution separate from the broader
Oracle migration discussion.

Generated-by: Codex (GPT-6)

This branch has not been deployed

No deployments
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.

7 participants