Skip to content

fix(ingestion/mysql): default unknown stored-procedure language to SQL instead of None#28898

Merged
harshsoni2024 merged 2 commits into
mainfrom
mysql_stored_proc_lang_fix
Jun 10, 2026
Merged

fix(ingestion/mysql): default unknown stored-procedure language to SQL instead of None#28898
harshsoni2024 merged 2 commits into
mainfrom
mysql_stored_proc_lang_fix

Conversation

@harshsoni2024

Copy link
Copy Markdown
Contributor

Fix ##28844

Description

  • When ingesting MySQL stored procedures and functions, the connector mapped
    the routine's reported language through STORED_PROC_LANGUAGE_MAP, which only
    contains a single entry for "SQL". The lookup used .get() with no default,
    so any other value returned by MySQL resolved to None, and the stored
    procedure was recorded with no language — silently, with no log message.

  • MySQL 8 can report ROUTINE_BODY = 'EXTERNAL' or other non-SQL bodies, which
    triggered this case.

Current Behaviour

  • STORED_PROC_LANGUAGE_MAP.get(stored_procedure.language) returns None for
    any reported language that is not exactly "SQL", so the routine is ingested
    with language=None.

Expected Behaviour

  • An unmapped or unexpected language value falls back to Language.SQL (MySQL
    routines are SQL in practice) rather than None.

Type of change:

  • Bug fix
  • Improvement
  • New feature
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation

High-level design:

N/A — small change.

Tests:

Use cases covered

Unit tests

Backend integration tests

Ingestion integration tests

Playwright (UI) tests

Manual testing performed

UI screen recording / screenshots:

Not applicable.

Checklist:

  • I have read the CONTRIBUTING document.
  • My PR title is Fixes <issue-number>: <short explanation>
  • My PR is linked to a GitHub issue via Fixes #<issue-number> above.
  • I have commented on my code, particularly in hard-to-understand areas.
  • For JSON Schema changes: I updated the migration scripts or explained why it is not needed.
  • For UI changes: I attached a screen recording and/or screenshots above.
  • I have added tests (unit / integration / Playwright as applicable) and listed them above.

The MySQL stored-procedure language lookup used
STORED_PROC_LANGUAGE_MAP.get(language) with no default, so any
ROUTINE_BODY value other than "SQL" (e.g. "EXTERNAL" on MySQL 8)
resolved to None and the routine was recorded with no language.

Add DEFAULT_STORED_PROC_LANGUAGE (Language.SQL) next to the map in
models.py and use it as the .get() fallback in metadata.py, so an
unmapped value falls back to SQL — which MySQL routines are in practice.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@harshsoni2024 harshsoni2024 requested a review from a team as a code owner June 10, 2026 05:37
Copilot AI review requested due to automatic review settings June 10, 2026 05:37
@github-actions

github-actions Bot commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

✅ PR checks passed

The linked issue has a description and all required Shipping project fields set. Thanks!

@github-actions github-actions Bot added Ingestion safe to test Add this label to run secure Github workflows on PRs labels Jun 10, 2026

Copilot AI 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.

Pull request overview

This PR aims to prevent MySQL stored procedure/function ingestion from recording a None language when MySQL reports a routine language/body not present in STORED_PROC_LANGUAGE_MAP, by defaulting to Language.SQL.

Changes:

  • Introduces DEFAULT_STORED_PROC_LANGUAGE = Language.SQL in MySQL models.
  • Updates stored procedure request creation to use STORED_PROC_LANGUAGE_MAP.get(..., DEFAULT_STORED_PROC_LANGUAGE).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
ingestion/src/metadata/ingestion/source/database/mysql/models.py Adds a default stored-procedure language constant alongside the language map.
ingestion/src/metadata/ingestion/source/database/mysql/metadata.py Uses the new default language when mapping the routine language into StoredProcedureCode.

Comment thread ingestion/src/metadata/ingestion/source/database/mysql/models.py
Comment thread ingestion/src/metadata/ingestion/source/database/mysql/metadata.py
Comment thread ingestion/src/metadata/ingestion/source/database/mysql/metadata.py
@github-actions

Copy link
Copy Markdown
Contributor

🟡 Playwright Results — all passed (11 flaky)

✅ 4272 passed · ❌ 0 failed · 🟡 11 flaky · ⏭️ 88 skipped

Shard Passed Failed Flaky Skipped
✅ Shard 1 301 0 0 4
🟡 Shard 2 805 0 1 9
🟡 Shard 3 802 0 2 8
🟡 Shard 4 846 0 1 12
🟡 Shard 5 720 0 1 47
🟡 Shard 6 798 0 6 8
🟡 11 flaky test(s) (passed on retry)
  • Features/Glossary/GlossaryWorkflow.spec.ts › should display correct status badge color and icon (shard 2, 1 retry)
  • Features/RTL.spec.ts › Verify Following widget functionality (shard 3, 1 retry)
  • Features/Tasks/TaskNavigation.spec.ts › navigating to /table/TASK-XXXXX should show 404 (invalid URL pattern) (shard 3, 1 retry)
  • Pages/CustomProperties.spec.ts › Time (shard 4, 1 retry)
  • Pages/Entity.spec.ts › Inactive Announcement create & delete (shard 5, 1 retry)
  • Pages/Glossary.spec.ts › Glossary Term Update in Glossary Page should persist tree (shard 6, 1 retry)
  • Pages/Lineage/LineageFilters.spec.ts › Verify lineage schema filter selection (shard 6, 1 retry)
  • Pages/Lineage/PlatformLineage.spec.ts › Verify domain platform view (shard 6, 1 retry)
  • Pages/Login.spec.ts › Refresh should work (shard 6, 1 retry)
  • Pages/ODCSImportExport.spec.ts › Multi-object ODCS contract - object selector shows all schema objects (shard 6, 1 retry)
  • Pages/ServiceEntity.spec.ts › Tier Add, Update and Remove (shard 6, 1 retry)

📦 Download artifacts

How to debug locally
# Download playwright-test-results-<shard> artifact and unzip
npx playwright show-trace path/to/trace.zip    # view trace

@harshsoni2024 harshsoni2024 linked an issue Jun 10, 2026 that may be closed by this pull request
2 tasks
…ROUTINE_BODY

The previous fallback was unreachable: MYSQL_GET_ROUTINES never selected
the routine body, so MysqlRoutine.language was always the model default
"SQL" and the language map never saw other values.

- queries.py: select ROUTINE_BODY AS language so the DB-reported language
  actually flows into MysqlRoutine
- models.py: map "EXTERNAL" to Language.External (MySQL 8 reports external
  routine bodies) and keep Language.SQL as the fallback for unknown values
- test_mysql.py: cover SQL/EXTERNAL/unknown language mapping through
  yield_stored_procedure(), and add the language column to the existing
  get_stored_procedures mock rows

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@sonarqubecloud

Copy link
Copy Markdown

@harshsoni2024 harshsoni2024 merged commit 40188da into main Jun 10, 2026
55 of 56 checks passed
@harshsoni2024 harshsoni2024 deleted the mysql_stored_proc_lang_fix branch June 10, 2026 15:43
@gitar-bot

gitar-bot Bot commented Jun 10, 2026

Copy link
Copy Markdown
Code Review ✅ Approved

Updates MySQL stored procedure ingestion to default unknown languages to SQL, preventing incorrect None values for non-SQL routine bodies. No issues found.

Options

Display: compact → Showing less information.

Comment with these commands to change:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Gitar

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

Labels

Ingestion safe to test Add this label to run secure Github workflows on PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MySQL: unknown stored-procedure language silently maps to None

3 participants