Commit 3aca578
Initial Oracle Support on Explain feature
Introduce comprehensive support for Oracle Database to the SQL Explain
panel in django-debug-toolbar. Unlike databases that support single-step
integrated query analysis (such as PostgreSQL's "EXPLAIN ANALYZE"),
Oracle requires a multi-step orchestration workflow to execute an
explain plan and format its output securely without session pollution.
Key Implementations & Changes:
1. Core Oracle Explain Orchestration:
- Implement `OracleExplainPlanHelper` to encapsulate the multi-step
explain plan lifecycle.
- Generate temporary execution nodes under a session-safe, unique
`STATEMENT_ID` (`dt_<uuid>`) within the session's `PLAN_TABLE`.
- Query `DBMS_XPLAN.DISPLAY` with `ADVANCED +ADAPTIVE` flags to
retrieve structured, human-readable execution plans.
- Clean up temporary rows from `PLAN_TABLE` at the end of execution.
- Suppress Query Block Registry (QBR) XML output on legacy Oracle
connections (< 21) to prevent memory exhaustion and infinite
recursion bugs on terminal client markdown parsers.
- Include a graceful schema health audit fallback that queries
`ALL_TABLES` and `ALL_INDEXES` metadata to format and append table
and index statistics (sizes, status, performance counters) as
aligned ASCII tables, sanitizing permission/database errors.
2. Query Tracking and Integration:
- Update `debug_toolbar/panels/sql/forms.py` to hook `SQLSelectForm`
and delegate select-explain execution to the new Oracle helper
when connected to an Oracle database.
- Update `debug_toolbar/panels/sql/tracking.py` to escape and filter
out toolbar queries using vendor-specific quoting (`quote_name`)
to prevent the toolbar's internal queries from showing up in and
polluting SQL panels.
3. Docker & Infrastructure Support:
- Introduce `docker-compose.yml` to provision local PostgreSQL,
MariaDB, and Oracle Database Free containers to facilitate
comprehensive multi-backend integration testing.
- Update `.github/workflows/test.yml` and `tox.ini` to define and
run tests against Oracle, and also ensuring coverage databases
do not collide during parallel test execution.
4. Comprehensive Test Coverage:
- Introduce `tests/panels/test_sql_oracle.py` with rigorous unit
tests mocking and verifying the helper's edge cases, legacy vs.
modern QBR handling, error boundary sanitization, and fallback
options.
- Add integration tests verifying correct explain output and
formatting across both synchronous and asynchronous contexts.
Fixes #2271 parent f95e032 commit 3aca578
18 files changed
Lines changed: 1246 additions & 11 deletions
File tree
- .github/workflows
- debug_toolbar
- panels/sql
- static/debug_toolbar/css
- templates/debug_toolbar/panels
- docs
- example
- tests
- panels
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
261 | 261 | | |
262 | 262 | | |
263 | 263 | | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
264 | 335 | | |
265 | 336 | | |
266 | 337 | | |
| |||
306 | 377 | | |
307 | 378 | | |
308 | 379 | | |
| 380 | + | |
309 | 381 | | |
310 | 382 | | |
311 | 383 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
82 | 89 | | |
83 | 90 | | |
84 | 91 | | |
| |||
0 commit comments