fix(ingestion/mysql): default unknown stored-procedure language to SQL instead of None#28898
Conversation
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>
✅ PR checks passedThe linked issue has a description and all required Shipping project fields set. Thanks! |
There was a problem hiding this comment.
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.SQLin 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. |
🟡 Playwright Results — all passed (11 flaky)✅ 4272 passed · ❌ 0 failed · 🟡 11 flaky · ⏭️ 88 skipped
🟡 11 flaky test(s) (passed on retry)
How to debug locally# Download playwright-test-results-<shard> artifact and unzip
npx playwright show-trace path/to/trace.zip # view trace |
…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>
|
Code Review ✅ ApprovedUpdates MySQL stored procedure ingestion to default unknown languages to SQL, preventing incorrect None values for non-SQL routine bodies. No issues found. OptionsDisplay: compact → Showing less information. Comment with these commands to change:
Was this helpful? React with 👍 / 👎 | Gitar |



Fix ##28844
Description
When ingesting MySQL stored procedures and functions, the connector mapped
the routine's reported language through
STORED_PROC_LANGUAGE_MAP, which onlycontains a single entry for
"SQL". The lookup used.get()with no default,so any other value returned by MySQL resolved to
None, and the storedprocedure was recorded with no language — silently, with no log message.
MySQL 8 can report
ROUTINE_BODY = 'EXTERNAL'or other non-SQL bodies, whichtriggered this case.
Current Behaviour
STORED_PROC_LANGUAGE_MAP.get(stored_procedure.language)returnsNoneforany reported language that is not exactly
"SQL", so the routine is ingestedwith
language=None.Expected Behaviour
Language.SQL(MySQLroutines are SQL in practice) rather than
None.Type of change:
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:
Fixes <issue-number>: <short explanation>Fixes #<issue-number>above.