Skip to content

feat: semantic layer extension - #37815

Merged
betodealmeida merged 79 commits into
masterfrom
semantic-layer-extension
May 5, 2026
Merged

feat: semantic layer extension#37815
betodealmeida merged 79 commits into
masterfrom
semantic-layer-extension

Conversation

@betodealmeida

@betodealmeida betodealmeida commented Feb 9, 2026

Copy link
Copy Markdown
Member

SUMMARY

This PR implements semantic layers (#35003) as an extension. It also includes a new unit test rule to enforce 100% coverage in the superset/semantic_layers/ directory.

Out of scope: currently we only have basic view permissions. I'm going to integrate semantic layers and semantic views with DAR in the next PR. I'll also add a better edit modal for semantic views, showing the existing metrics and dimensions; the current one is just a placeholder for additional metadata.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

TESTING INSTRUCTIONS

  1. Enable semantic layers by editing docker/pythonpath_dev/superset_config.py:
diff --git a/docker/pythonpath_dev/superset_config.py b/docker/pythonpath_dev/superset_config.py
index 108305cf90..ce7f199870 100644
--- a/docker/pythonpath_dev/superset_config.py
+++ b/docker/pythonpath_dev/superset_config.py
@@ -105,7 +105,13 @@ class CeleryConfig:

 CELERY_CONFIG = CeleryConfig

-FEATURE_FLAGS = {"ALERT_REPORTS": True, "DATASET_FOLDERS": True}
+FEATURE_FLAGS = {
+    "ALERT_REPORTS": True,
+    "DATASET_FOLDERS": True,
+    "ENABLE_EXTENSIONS": True,
+    "SEMANTIC_LAYERS": True,
+}
+EXTENSIONS_PATH = "/app/docker/extensions"
 ALERT_REPORTS_NOTIFICATION_DRY_RUN = True
 WEBDRIVER_BASEURL = f"http://superset_app{os.environ.get('SUPERSET_APP_ROOT', '/')}/"  # When using docker compose baseurl should be http://superset_nginx{ENV{BASEPATH}}/  # noqa: E501
 # The base URL for the email report hyperlinks.
  1. Get the latest Pandas semantic layer from https://github.com/betodealmeida/pandas-semantic-layer/releases. Put the .supx file inside docker/extensions.
  2. Run:
docker compose build --no-cache  # this ensure permissions for new views are created
docker compose up
  1. Go to the databases CRUD, but add a semantic layer instead.
  2. Go to the dataset CRUD, but add a semantic view instead.
  3. Click the semantic view and create a chart from it.

ADDITIONAL INFORMATION

  • Has associated issue: [SIP-182] Semantic Layer Support in Apache Superset #35003
  • Required feature flags: SEMANTIC_LAYERS
  • 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

@github-actions github-actions Bot added the github_actions Pull requests that update GitHub Actions code label Feb 9, 2026
@netlify

netlify Bot commented Feb 9, 2026

Copy link
Copy Markdown

Deploy Preview for superset-docs-preview ready!

Name Link
🔨 Latest commit 66f7f62
🔍 Latest deploy log https://app.netlify.com/projects/superset-docs-preview/deploys/69f9eb9b9c73f1000852a0f6
😎 Deploy Preview https://deploy-preview-37815--superset-docs-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@bito-code-review bito-code-review Bot 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.

Code Review Agent Run #0e1b4d

Actionable Suggestions - 2
  • superset/semantic_layers/mapper.py - 1
  • superset-core/pyproject.toml - 1
Additional Suggestions - 1
  • tests/unit_tests/semantic_layers/mapper_test.py - 1
    • Misleading test comment · Line 336-349
      The test comment claims to verify that TEMPORAL_RANGE filters are skipped, but the assertion passes because the 'order_date' column is not present in the empty all_dimensions dictionary. This tests unknown column handling, not TEMPORAL_RANGE skipping. Consider updating the comment or modifying the test to properly validate TEMPORAL_RANGE behavior.
Filtered by Review Rules

Bito filtered these suggestions based on rules created automatically for your feedback. Manage rules.

  • superset/semantic_layers/mapper.py - 1
Review Details
  • Files reviewed - 7 · Commit Range: cb5281b..0c33cfc
    • superset-core/pyproject.toml
    • superset-core/src/superset_core/semantic_layers/semantic_layer.py
    • superset-core/src/superset_core/semantic_layers/semantic_view.py
    • superset-core/src/superset_core/semantic_layers/types.py
    • superset/semantic_layers/__init__.py
    • superset/semantic_layers/mapper.py
    • tests/unit_tests/semantic_layers/mapper_test.py
  • Files skipped - 1
    • .github/workflows/superset-python-unittest.yml - Reason: Filter setting
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful
    • MyPy (Static Code Analysis) - ✔︎ Successful
    • Astral Ruff (Static Code Analysis) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

Comment thread superset/semantic_layers/mapper.py Outdated
time_offset,
all_dimensions,
)
print(">>", filters)

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.

Debug print statement in production code

Remove debug print statement before merging. This should be replaced with proper logging if needed.

Code suggestion
Check the AI-generated fix before applying
 -        print(">>>", filters)

Code Review Run #0e1b4d


Should Bito avoid suggestions like this for future reviews? (Manage Rules)

  • Yes, avoid them

Comment thread superset-core/pyproject.toml
@michael-s-molina

michael-s-molina commented Mar 3, 2026

Copy link
Copy Markdown
Member

@betodealmeida Was your intention to commit this to the feature branch instead of master?

@betodealmeida

Copy link
Copy Markdown
Member Author

@betodealmeida Was your intention to commit this to the feature branch instead of master?

My idea is that semantic-layer-extension is a feature branch. We'll merge it to master when the feature is ready.

@michael-s-molina

Copy link
Copy Markdown
Member

My idea is that semantic-layer-extension is a feature branch. We'll merge it to master when the feature is ready.

Ah ok. Maybe is better to keep this PR as a draft then until we merge all PRs to semantic-layer-extension?

@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.

So stoked for this! Extensions for everything! <img src='oprah.gif' alt='YOU get an extension! YOU get an extension!'>

@bito-code-review

Copy link
Copy Markdown
Contributor

Bito Automatic Review Skipped – PR Already Merged

Bito scheduled an automatic review for this pull request, but the review was skipped because this PR was merged before the review could be run.
No action is needed if you didn't intend to review it. To get a review, you can type /review in a comment and save it

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

Labels

api Related to the REST API data:data modeling dependencies:npm doc Namespace | Anything related to documentation github_actions Pull requests that update GitHub Actions code packages plugins preset-io review:draft risk:db-migration PRs that require a DB migration size/XXL

Projects

Development

Successfully merging this pull request may close these issues.

9 participants