Skip to content

fix(providers/oracle): use conn.schema as service_name fallback in OracleHook#62895

Open
YoannAbriel wants to merge 3 commits intoapache:mainfrom
YoannAbriel:fix/issue-62526
Open

fix(providers/oracle): use conn.schema as service_name fallback in OracleHook#62895
YoannAbriel wants to merge 3 commits intoapache:mainfrom
YoannAbriel:fix/issue-62526

Conversation

@YoannAbriel
Copy link
Contributor

OracleHook.get_conn() ignores conn.schema when building the DSN. When users fill Host, Port, and Schema in the connection UI without setting service_name in extras, the DSN is constructed without any service name — causing ORA-12504: TNS:listener was not given the SERVICE_NAME in CONNECT_DATA.

The Schema field in the UI maps to conn.schema, which for Oracle is typically the service name. This fix falls back to conn.schema as service_name when neither service_name nor sid is explicitly set in extras. Explicit extras still take precedence.

Added three tests covering: schema-as-service-name fallback, service_name precedence over schema, and sid precedence over schema.

Closes: #62526


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

Generated-by: Claude Code 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 or {issue_number}.significant.rst, in airflow-core/newsfragments.

@Srabasti
Copy link
Contributor

Srabasti commented Mar 5, 2026

Static check failure due to unrelated failures for which fix #62897 is already in place by @potiuk

You can trigger CI from your end @YoannAbriel, or wait until it is retriggered from maintainers.

@YoannAbriel YoannAbriel force-pushed the fix/issue-62526 branch 9 times, most recently from e9f1902 to be511b3 Compare March 5, 2026 22:31
…acleHook

When creating an Oracle connection via the UI with Host, Port, and Schema
fields filled but without explicitly setting service_name in extras,
get_conn() built the DSN without a service name, causing TNS errors.

Now conn.schema is used as the service_name when neither service_name
nor sid is set in connection extras.

Fixes apache#62526
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.

[apache-airflow-providers-oracle] inconsistent setup when using Extra Fields

2 participants