Skip to content

Commit 1738c85

Browse files
mistercrunchclaude
andcommitted
fix: Ensure SUPERSET__SQLALCHEMY_EXAMPLES_URI takes absolute precedence
- Add explicit environment variable checks to prevent config override - Add final override at end of Docker config to ensure DuckDB URI is used - Fixes issue where SQLite default was overriding DuckDB environment variable in AWS Based on AWS logs showing env var set correctly but app config using SQLite default. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent e0b1449 commit 1738c85

File tree

1 file changed

+21
-6
lines changed

1 file changed

+21
-6
lines changed

docker/pythonpath_dev/superset_config.py

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,17 @@
5050
)
5151

5252
# Use environment variable if set, otherwise construct from components
53-
SQLALCHEMY_EXAMPLES_URI = os.getenv(
54-
"SUPERSET__SQLALCHEMY_EXAMPLES_URI",
55-
f"{DATABASE_DIALECT}://"
56-
f"{EXAMPLES_USER}:{EXAMPLES_PASSWORD}@"
57-
f"{EXAMPLES_HOST}:{EXAMPLES_PORT}/{EXAMPLES_DB}",
58-
)
53+
# This MUST take precedence over any other configuration
54+
_examples_uri_env = os.getenv("SUPERSET__SQLALCHEMY_EXAMPLES_URI")
55+
if _examples_uri_env:
56+
SQLALCHEMY_EXAMPLES_URI = _examples_uri_env
57+
else:
58+
# Fallback to PostgreSQL construction only if env var not set
59+
SQLALCHEMY_EXAMPLES_URI = (
60+
f"{DATABASE_DIALECT}://"
61+
f"{EXAMPLES_USER}:{EXAMPLES_PASSWORD}@"
62+
f"{EXAMPLES_HOST}:{EXAMPLES_PORT}/{EXAMPLES_DB}"
63+
)
5964

6065
# SUPERDEBUG: Log the Docker config override for examples URI
6166
logger = logging.getLogger(__name__)
@@ -163,3 +168,13 @@ class CeleryConfig:
163168
)
164169
except ImportError:
165170
logger.info("Using default Docker config...")
171+
172+
# FINAL OVERRIDE: Ensure SUPERSET__SQLALCHEMY_EXAMPLES_URI takes absolute precedence
173+
# This must be the last thing executed to override any other config files
174+
_final_examples_uri = os.getenv("SUPERSET__SQLALCHEMY_EXAMPLES_URI")
175+
if _final_examples_uri:
176+
SQLALCHEMY_EXAMPLES_URI = _final_examples_uri
177+
logger.info(
178+
f"SUPERDEBUG [docker/pythonpath_dev/superset_config.py]: "
179+
f"FINAL OVERRIDE - SQLALCHEMY_EXAMPLES_URI set to: {SQLALCHEMY_EXAMPLES_URI}"
180+
)

0 commit comments

Comments
 (0)