|
50 | 50 | )
|
51 | 51 |
|
52 | 52 | # 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 | + ) |
59 | 64 |
|
60 | 65 | # SUPERDEBUG: Log the Docker config override for examples URI
|
61 | 66 | logger = logging.getLogger(__name__)
|
@@ -163,3 +168,13 @@ class CeleryConfig:
|
163 | 168 | )
|
164 | 169 | except ImportError:
|
165 | 170 | 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