ephraimbuddy commented on code in PR #24156:
URL: https://github.com/apache/airflow/pull/24156#discussion_r913113969
##########
airflow/utils/db.py:
##########
@@ -655,16 +655,34 @@ def create_default_connections(session: Session =
NEW_SESSION):
@provide_session
def initdb(session: Session = NEW_SESSION):
"""Initialize Airflow database."""
- upgradedb(session=session)
-
+ from alembic import command
+ from flask import Flask
+ from flask_sqlalchemy import SQLAlchemy
+
+ from airflow.models import Base
+ from airflow.www.fab_security.sqla.models import Model
+ from airflow.www.session import AirflowDatabaseSessionInterface
+
+ def _create_flask_session_tb():
+ flask_app = Flask(__name__)
+ flask_app.config['SQLALCHEMY_DATABASE_URI'] = conf.get('database',
'SQL_ALCHEMY_CONN')
+ db = SQLAlchemy(flask_app)
+ AirflowDatabaseSessionInterface(app=flask_app, db=db, table='session',
key_prefix='')
+ db.create_all()
+
+ Base.metadata.create_all(settings.engine)
+ Model.metadata.create_all(settings.engine)
+ _create_flask_session_tb()
Review Comment:
```suggestion
_create_flask_session_tbl()
```
--
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]