cansjt commented on issue #17374:
URL: https://github.com/apache/airflow/issues/17374#issuecomment-890900713


   I think if you use a framework to build an application, that application 
should control the behavior of the framework, not let it do as it pleases.
   
   I am no specialist of Flask AppBuilder but my understanding is that you use 
it with regular SQLAlchemy declarative ORM models. So I am guessing you should 
be able to create those models with the appropriate `MetaData` object (w. 
custom base model class ?), specifying the same schema as other Airflow models 
or override the schema name on a per model basis. Though both method mean you 
need the configuration available while loading (importing) the models or make 
sure no model is ever imported before the configuration has been parsed...
   
   You might also want ot have a look at this FAB issue: 
https://github.com/dpgaspar/Flask-AppBuilder/issues/1585 (fairly recent March 
of this year)
   The last solution seems "cleaner" to me:
   ```python
   db = SQLAlchemy(app)
   db_eng = db.engine.execution_options(schema_translate_map= {None: 
configuration.get('core', 'SQL_ALCHEMY_SCHEMA')})
   Session = sessionmaker(bind=db_eng)
   db_sess = scoped_session(Session)
   appbuilder = AppBuilder(app, db_sess)
   ```
   Not sure it fits the current implementation though.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to