@@ -318,7 +318,7 @@ async fn build_import_job(
318318) -> Result < Job > {
319319 let mut commands = vec ! [ ] ;
320320
321- let config = "import os; SQLALCHEMY_DATABASE_URI = os.environ.get('SQLALCHEMY_DATABASE_URI')" ;
321+ let config = "import os; SQLALCHEMY_DATABASE_URI = os.path.expandvars(os. environ.get('SQLALCHEMY_DATABASE_URI') )" ;
322322 commands. push ( format ! ( "mkdir -p {PYTHONPATH}" ) ) ;
323323 commands. push ( format ! (
324324 "echo \" {config}\" > {PYTHONPATH}/{SUPERSET_CONFIG_FILENAME}"
@@ -345,20 +345,7 @@ async fn build_import_job(
345345 container_builder
346346 . image_from_product_image ( resolved_product_image)
347347 . command ( vec ! [ "/bin/bash" . to_string( ) ] )
348- . args ( vec ! [
349- String :: from( "-c" ) ,
350- // SQLALCHEMY_DATABASE_URI contains a template with bash variable references
351- // (e.g. ${METADATA_DATABASE_USERNAME}) that must be resolved before Python
352- // reads it via os.environ. Airflow's config system calls expandvars()
353- // on env var values automatically (see [1]), but Superset does not - so we
354- // resolve them here with eval.
355- // [1] https://github.com/apache/airflow/blob/2.10.5/airflow/configuration.py#L1084-L1086
356- // (same behaviour in 3.x: shared/configuration/src/airflow_shared/configuration/parser.py)
357- format!(
358- "export SQLALCHEMY_DATABASE_URI=$(eval echo \" $SQLALCHEMY_DATABASE_URI\" )\n {}" ,
359- commands. join( "; " )
360- ) ,
361- ] )
348+ . args ( vec ! [ String :: from( "-c" ) , commands. join( "; " ) ] )
362349 . add_env_var (
363350 "SQLALCHEMY_DATABASE_URI" ,
364351 metadata_database_connection_details. url_template . clone ( ) ,
0 commit comments