Skip to content

chore(logging): log unparseable virtual dataset SQL at debug in the RLS lookup - #46139

Merged
rusackas merged 6 commits into
apache:masterfrom
aminghadersohi:chore-virtual-dataset-parse-log-level
Nov 21, 2026
Merged

rusackas merged 6 commits into
apache:masterfrom
aminghadersohi:chore-virtual-dataset-parse-log-level

Conversation

@aminghadersohi

Copy link
Copy Markdown
Contributor

SUMMARY

DatasetDAO._parse_tables_from_virtual_datasets (used by the inherited RLS indicator on the dataset list and datasource list) logged Failed to parse SQL for virtual dataset at WARNING with a full traceback for every virtual dataset whose SQL fails to parse, on every list load. The failure is already handled (the dataset is skipped and simply gets no inherited RLS badge), so on deployments with a few such datasets this produces thousands of warning+traceback lines per day for an expected condition.

This logs it at DEBUG instead, with the dataset id and the exception message and no traceback. Behaviour is otherwise unchanged: the dataset is skipped, other datasets still get their mapping, and the API response is identical.

Sibling logger.warning(..., exc_info=True) calls on the same path:

  • DatasetDAO.get_rls_filters_for_dataset (the Failed to resolve inherited RLS for virtual dataset warning) is left as is. It runs once per single-dataset request (explore / dataset get) rather than once per dataset per list load, and its try also wraps the RLS metadata queries, where a failure is a real error worth a WARNING with a traceback.
  • superset/commands/explore/get.py has no logger.warning(..., exc_info=True) call; its except Exception around the RLS lookup sets rls_filters = [] without logging.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

N/A

TESTING INSTRUCTIONS

pytest tests/unit_tests/dao/dataset_rls_test.py

The new test_parse_tables_from_virtual_datasets_bad_sql_does_not_warn feeds one unparseable and one parseable virtual dataset, asserts the parseable one is still mapped and that no WARNING-or-higher record is emitted. It fails on master (a WARNING record is emitted) and passes with this change.

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

…ookup

The inherited-RLS lookup for the dataset and datasource lists logged a
WARNING with a traceback for every virtual dataset whose SQL fails to
parse, on every list load. The failure is already handled (the dataset
just gets no inherited RLS badge), so log it at DEBUG without a traceback.
@codecov

codecov Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.92%. Comparing base (3f3faff) to head (b0b1ff0).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #46139      +/-   ##
==========================================
- Coverage   85.92%   85.92%   -0.01%     
==========================================
  Files        3122     3122              
  Lines      216871   216871              
  Branches    51421    51421              
==========================================
- Hits       186352   186350       -2     
- Misses      27101    27102       +1     
- Partials     3418     3419       +1     
Flag Coverage Δ
hive 33.88% <0.00%> (ø)
mysql 51.56% <0.00%> (+<0.01%) ⬆️
postgres 51.59% <0.00%> (-0.01%) ⬇️
presto 35.56% <0.00%> (ø)
python 88.42% <100.00%> (-0.01%) ⬇️
sqlite 51.26% <0.00%> (ø)
unit 83.84% <100.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@aminghadersohi

Copy link
Copy Markdown
Contributor Author

Acceptance run at d60ebf0 against a real Superset app (SQLite metadata DB, Admin and a Gamma-based viewer, two unparseable and two parseable virtual datasets):

  • GET /api/v1/dataset/ (3 loads) plus GET /api/v1/datasource/ (1 load): merge base 4e7fa63 emits 8 WARNING records with tracebacks per user; this head emits none at the default INFO level, and 8 DEBUG records (Failed to parse SQL for virtual dataset 3: Error parsing near '(' at line 1:15) with no traceback at DEBUG.
  • Responses are identical to the merge base for both roles: parseable virtual datasets keep their inherited RLS (including one that joins two RLS tables), unparseable ones return [].
  • test_parse_tables_from_virtual_datasets_bad_sql_does_not_warn fails on the merge base (WARNING at dataset.py:1053) and passes here; tests/unit_tests/dao/, commands/datasource/ and commands/explore/ pass (283).

One note on the sibling left as is: opening explore on the same unparseable dataset still logs Failed to resolve inherited RLS for virtual dataset <id> at WARNING with a traceback, once per explore open, because that try wraps both the parse and the RLS queries. The reasoning in the description holds; narrowing that try to the parse would be a small follow-up if that line turns out noisy too.

@aminghadersohi
aminghadersohi marked this pull request as ready for review November 14, 2026 07:19
@codeant-ai-for-open-source

codeant-ai-for-open-source Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

CodeAnt  CodeAnt PR Risk

🟢  Low Risk

  • The PR appears safe to merge; no actionable issues were identified in the review.

Assessed commit: b0b1ff0ba9de

@rusackas rusackas left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @aminghadersohi, nice to see the noisy traceback go away for something we already handle. LGTM!

@aminghadersohi

Copy link
Copy Markdown
Contributor Author

Thanks @rusackas, appreciate the review.

@rusackas
rusackas merged commit 04c4287 into apache:master Nov 21, 2026
72 checks passed
jprinet added a commit to jprinet/superset that referenced this pull request Nov 23, 2026
* origin/master: (393 commits)
  fix(a11y): name the semantic view description input (apache#46458)
  docs(semantic): explain datasource list modification eligibility (apache#46462)
  docs(semantic-layer): document NULL-preserving exclusion filters (apache#46447)
  fix(uploads): skip folder and system entries in columnar ZIP uploads (apache#45617)
  fix(i18n-es): promote 47 of the zero-context backfill entries (apache#45847)
  fix(mcp): return structured ChartError on SQLAlchemyError in get_chart_sql (apache#44351)
  fix(datasets): follow semantic view modification permissions (apache#46448)
  fix(docker): account for container memory limits in frontend-mem-nag.sh (apache#46373)
  fix(reports): carry the report's native filters in the email and Slack link (apache#46062)
  fix(explore): apply the dataset timezone to grained temporal filter values (apache#46175)
  fix(i18n): enforce the do-not-translate registry across the catalogs (apache#45974)
  chore(logging): log unparseable virtual dataset SQL at debug in the RLS lookup (apache#46139)
  fix(i18n): split parameter-suggestion plural into two messages (apache#46049)
  test(partition-mapping): cover Hive/Impala mirrored SQL, cache outage and migration (apache#46319)
  perf(dashboard): look up the dashboard once per filter_state read (apache#46314)
  fix(i18n): load the dayjs locale for every language with a catalog (apache#45982)
  test(semantic-layer): make date export parametrization deterministic (apache#46449)
  fix(oauth2): idempotent OAuth2 completion and resilient listener (apache#40292)
  fix(explore): prevent full table scan when SQL expression is used as x-axis (apache#41339)
  feat(mcp): radar chart type plugin (apache#43571)
  ...

# Conflicts:
#	.github/workflows/docker.yml
#	.github/workflows/superset-frontend.yml
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.

3 participants