Skip to content

Commit dda62d3

Browse files
rusackasclaude
andcommitted
fix(examples): Handle import outside Flask app context
Wrap discover_datasets() call in try/except to gracefully handle imports outside of an active Flask application context (e.g., in tests or tooling). Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent d4dbd1f commit dda62d3

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

‎superset/examples/data_loading.py‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,11 @@ def discover_datasets() -> Dict[str, Callable[..., None]]:
166166

167167

168168
# Auto-discover and create all dataset loaders
169-
_auto_loaders = discover_datasets()
169+
try:
170+
_auto_loaders = discover_datasets()
171+
except RuntimeError:
172+
# Outside Flask app context (e.g., tests, tooling)
173+
_auto_loaders = {}
170174

171175
# Add auto-discovered loaders to module namespace
172176
globals().update(_auto_loaders)

0 commit comments

Comments
 (0)