GitHub user starkmarkus edited a comment on the discussion: Airflow cli 
response times

I think the traceback shows something slightly different: it does not 
necessarily mean that `airflow --help` is already talking to the database. It 
looks like Airflow initializes its settings during import and tries to parse 
the configured `sql_alchemy_conn` in order to derive the async SQLAlchemy URI.

The important part seems to be this:

```text
SQL_ALCHEMY_CONN_ASYNC = 
_get_async_conn_uri_from_sync(sync_uri=SQL_ALCHEMY_CONN)
...
scheme, rest = sync_uri.split(":", maxsplit=1)
ValueError: not enough values to unpack
```

So I would first check whether `AIRFLOW__DATABASE__SQL_ALCHEMY_CONN` or the 
corresponding `airflow.cfg` value is set to something invalid in that test 
environment. For example, an empty value, placeholder, secret name, or 
otherwise malformed value without a `:` would explain this error.

A quick check could be:

```bash
airflow config get-value database sql_alchemy_conn
env | grep AIRFLOW__DATABASE__SQL_ALCHEMY_CONN
```

Or, if the CLI crashes too early:

```bash
python - <<'PY'
import os
print(repr(os.environ.get("AIRFLOW__DATABASE__SQL_ALCHEMY_CONN")))
PY
```

For a simple local/test setup, you could also try setting it explicitly to a 
valid SQLite URL just to compare startup behavior:

```bash
export AIRFLOW__DATABASE__SQL_ALCHEMY_CONN='sqlite:////tmp/airflow.db'
time airflow --help
```

So my current guess would be:

- `airflow --help` does import and initialize quite a bit of Airflow, so it is 
not expected to be instant.
- This specific traceback is probably caused by an invalid database URI 
configuration, not by an actual failed database connection.
- The slow startup may still be related to the environment, filesystem, 
installed packages, or import overhead, but I would verify the DB URI first 
before drawing conclusions from this run.

GitHub link: 
https://github.com/apache/airflow/discussions/68707#discussioncomment-17363623

----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: [email protected]

Reply via email to