Dev-iL commented on code in PR #40069:
URL: https://github.com/apache/airflow/pull/40069#discussion_r1630941654
##########
airflow/settings.py:
##########
@@ -278,17 +278,24 @@ def remove(*args, **kwargs):
pass
+def _is_sqlite_db_path_relative(sqla_conn_str: str) -> bool:
+ """Determine whether the database connection URI specifies a relative
path."""
+ import re2
+
+ return (
+ bool(sqla_conn_str)
+ and sqla_conn_str.startswith("sqlite")
+ # In memory is not useful for production, but useful for writing tests
against Airflow for extensions
+ and sqla_conn_str != "sqlite://"
+ and not os.path.isabs(re2.sub(r"^sqlite:///", "", sqla_conn_str))
+ )
Review Comment:
I don't like magic numbers, would it be acceptable to use
```python
if (
sqla_conn_str.startswith(abs_prefix := "sqlite:///")
and os.path.isabs(sqla_conn_str[len(abs_prefix):])
):
```
?
--
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]