amoghrajesh commented on code in PR #45139:
URL: https://github.com/apache/airflow/pull/45139#discussion_r1894757123


##########
providers/src/airflow/providers/fab/auth_manager/cli_commands/utils.py:
##########
@@ -50,4 +54,12 @@ def get_application_builder() -> 
Generator[AirflowAppBuilder, None, None]:
     with flask_app.app_context():
         # Enable customizations in webserver_config.py to be applied via 
Flask.current_app.
         flask_app.config.from_pyfile(webserver_config, silent=True)
+        flask_app.config["SQLALCHEMY_DATABASE_URI"] = conf.get("database", 
"SQL_ALCHEMY_CONN")
+        url = make_url(flask_app.config["SQLALCHEMY_DATABASE_URI"])
+        if url.drivername == "sqlite" and url.database and not 
isabs(url.database):
+            raise AirflowConfigException(
+                f'Cannot use relative path: `{conf.get("database", 
"SQL_ALCHEMY_CONN")}` to connect to sqlite. '

Review Comment:
   Will we be able to cover this using unit tests?



##########
providers/src/airflow/providers/fab/auth_manager/cli_commands/utils.py:
##########
@@ -50,4 +54,12 @@ def get_application_builder() -> 
Generator[AirflowAppBuilder, None, None]:
     with flask_app.app_context():
         # Enable customizations in webserver_config.py to be applied via 
Flask.current_app.
         flask_app.config.from_pyfile(webserver_config, silent=True)
+        flask_app.config["SQLALCHEMY_DATABASE_URI"] = conf.get("database", 
"SQL_ALCHEMY_CONN")
+        url = make_url(flask_app.config["SQLALCHEMY_DATABASE_URI"])
+        if url.drivername == "sqlite" and url.database and not 
isabs(url.database):
+            raise AirflowConfigException(
+                f'Cannot use relative path: `{conf.get("database", 
"SQL_ALCHEMY_CONN")}` to connect to sqlite. '

Review Comment:
   Because it was a gap so far that wasn't caught, unit tests will ensure that 
we do not create that gap again



##########
providers/src/airflow/providers/fab/auth_manager/cli_commands/utils.py:
##########
@@ -50,4 +54,12 @@ def get_application_builder() -> 
Generator[AirflowAppBuilder, None, None]:
     with flask_app.app_context():
         # Enable customizations in webserver_config.py to be applied via 
Flask.current_app.
         flask_app.config.from_pyfile(webserver_config, silent=True)
+        flask_app.config["SQLALCHEMY_DATABASE_URI"] = conf.get("database", 
"SQL_ALCHEMY_CONN")
+        url = make_url(flask_app.config["SQLALCHEMY_DATABASE_URI"])
+        if url.drivername == "sqlite" and url.database and not 
isabs(url.database):
+            raise AirflowConfigException(
+                f'Cannot use relative path: `{conf.get("database", 
"SQL_ALCHEMY_CONN")}` to connect to sqlite. '

Review Comment:
   ```suggestion
                   f"Cannot use relative path: `{conf.get("database", 
"SQL_ALCHEMY_CONN")}` to connect to sqlite."
   ```



-- 
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