Course recordings on DaDesktop for Training platform
Visit NobleProg websites for related course
Visit outline: Getting Started with Apache Superset (Course code: superset)
Categories: Apache Superset
Summary
Overview
This course session provides an in-depth, hands-on exploration of Apache Superset for data visualization and dashboarding, with a focus on dynamic query personalization, public access configuration, geographic visualizations (GeoJSON, deck.gl, country maps), and integration with external data sources like Google Sheets. The trainer demonstrates advanced features including user-based macros, URL parameter injection, feature flags for public role access, custom map integration, and interactive dashboard layout design. The session includes live troubleshooting, collaborative problem-solving, and practical exercises on geospatial data handling, culminating in a guided workflow for creating and sharing interactive dashboards with both authenticated and anonymous users.
Topic (Timeline)
1. Dynamic Query Personalization & User Context [00:00:01 - 00:13:47]
- Demonstrated use of SQL queries that dynamically inject user context using Superset macros:
{{ current_user_name }},{{ username }},{{ transaction_id }}. - Showed how to retrieve browser/environment variables (e.g., from URL parameters) directly within queries using Jinja templating syntax (
{{ }}for values,{% %}for logic). - Highlighted use cases: personalizing dashboards per user (e.g., showing only their data), filtering by URL parameters (e.g.,
?department=FR-01). - Warned about security risks: unvalidated URL parameters can enable SQL injection; recommended use only in controlled environments.
- Discussed integration with eFrame (embedded dashboards) to pass parameters securely via URL without requiring login.
2. Public Access & Feature Flags Configuration [00:13:47 - 00:26:40]
- Explained how to enable public access to dashboards via Superset’s
PUBLIC_ROLE_LIKEfeature flag, setting it togammato grant read-only access to unauthenticated users. - Clarified distinction between user roles (Public, Gamma) and feature flags: feature flags are global configuration toggles, not per-dashboard permissions.
- Demonstrated workflow: (1) enable
PUBLIC_ROLE_LIKE=gamma, (2) assign dashboard read permissions to the Public role individually. - Showed that public and authenticated users share the same dashboard URL; permalink functionality preserves filter states for sharing.
- Emphasized that administrators, not end-users, manage these settings.
3. Geographic Visualizations: Country Maps & GeoJSON [00:26:40 - 00:48:17]
- Introduced three Superset geospatial chart types: Country Map, Deck.gl, and GeoJSON.
- Focused on Country Map: used built-in France department and region maps; explained required ISO codes (e.g.,
FR-01) for data joining. - Demonstrated how to add custom geographic boundaries (e.g., communes) by modifying
countries.tsand adding GeoJSON files in the Superset frontend codebase. - Warned about performance issues: large GeoJSON files (>1MB) cause frontend lag; recommended simplifying geometries (e.g., reduce vertex density) for 35,000+ communes.
- Discussed data preparation: join internal dataset IDs with GeoJSON feature IDs (e.g., via lookup table or data transformation).
- Mentioned QGIS as a tool for simplifying and exporting GeoJSON for Superset.
4. Advanced Geospatial: Deck.gl & Point/Heatmap Visualizations [00:48:17 - 01:50:17]
- Demonstrated Deck.gl for rendering point clouds, hexbin grids, and heatmaps from latitude/longitude data.
- Showed how to visualize point data (e.g., oil wells) using Scatterplot and Heatmap layers, with color and size encoding based on categorical/numerical fields.
- Explained that Deck.gl renders points independently of background maps; Mapbox tiles can be added via API key (not configured in demo).
- Walked through importing CSV data via Google Sheets: created sample dataset with
latitude,longitude, andcountfields. - Troubleshot data import issues: inverted lat/long fields, encoding errors, and CSV separator mismatches.
- Confirmed that Deck.gl supports GeoJSON input via a dedicated column in CSV, but CSV with lat/long columns is simpler for beginners.
- Highlighted flexibility: 5-minute setup from raw data to interactive map.
5. Dashboard Layout, Custom Elements & Data Integration [01:50:17 - 02:10:45]
- Demonstrated dashboard layout editing: added Markdown text blocks, titles, dividers, and custom HTML (e.g., icons, images).
- Explained image storage: custom images must be hosted in Superset’s frontend (requires terminal access); not available via UI.
- Showed how to use Layout Elements to arrange charts in rows/columns, resize containers, and create custom visual hierarchies.
- Walked through creating datasets from Google Sheets: shared public link, connected via “Connect Google Sheets,” selected sheet tab.
- Emphasized best practices: use clean column headers, avoid special characters, ensure correct data types (numeric for metrics).
- Concluded with a call to action: participants to experiment with their own datasets using the provided Google Sheet template and practice creating country maps and Deck.gl visualizations.
6. Wrap-up, Q&A & Next Steps [02:10:45 - 02:10:45]
- Summarized key takeaways: dynamic queries, public access via feature flags, geospatial data handling, and layout customization.
- Encouraged participants to test workflows independently using the shared Google Sheet and Superset instance.
- Announced next session at 13:00, following a break.
Appendix
Key Principles
- Dynamic Queries: Use Jinja macros (
{{ current_user_name }},{{ url_param }}) to personalize SQL queries based on user or context. - Security: Never expose raw URL parameters in queries without validation; use in controlled environments only.
- Public Access: Enable via
PUBLIC_ROLE_LIKE=gamma+ assign dashboard permissions to Public role. - Geospatial Data: Use ISO codes (e.g.,
FR-01) to join data with built-in maps; simplify GeoJSON for performance. - Deck.gl: Ideal for point/heatmap visualizations; requires lat/long columns; supports Mapbox background with API key.
Tools Used
- Apache Superset (v2+)
- Google Sheets (for CSV data import)
- QGIS (for GeoJSON simplification)
- Mapbox (for custom basemaps, optional)
- Docker (for Superset deployment)
- Terminal / CLI (for feature flag and GeoJSON configuration)
Common Pitfalls
- Inverted latitude/longitude fields causing data to render in wrong locations (e.g., Somalia instead of France).
- Large GeoJSON files (>1MB) causing browser lag or failure to load.
- CSV encoding or separator issues (commas vs. periods, UTF-8).
- Missing
PUBLIC_ROLE_LIKEflag preventing public access even with correct permissions. - Google Sheets not shared publicly → “Connection failed” error.
Practice Suggestions
- Create a Google Sheet with 5–10 rows of lat/long + metric (e.g., pollution levels, population).
- Connect to Superset and create a Deck.gl Scatterplot or Heatmap.
- Enable
PUBLIC_ROLE_LIKE=gammaand share dashboard link with a non-logged-in user. - Try adding a custom GeoJSON (e.g., French regions) and join with a dataset using
FR-01codes. - Add a Markdown text block with icons or a title to a dashboard layout.