dosubot[bot] commented on issue #30187:
URL: https://github.com/apache/superset/issues/30187#issuecomment-2336798080
<!-- Greeting -->
Hey @Vucko95! I'm here to help you with any bugs, questions, or
contributions you have for Superset. Let's tackle this issue together!
<!-- Answer -->
The connection between Superset and the database is not automatically set
when the `SUPERSET_DATABASE_URI` environment variable is defined in the
Docker-compose file because the `SUPERSET_DATABASE_URI` environment variable is
not being used in the `superset_config.py` file. Instead, the connection string
is constructed using individual environment variables like `DATABASE_DIALECT`,
`DATABASE_USER`, `DATABASE_PASSWORD`, `DATABASE_HOST`, `DATABASE_PORT`, and
`DATABASE_DB`.
Here is the relevant code snippet from `superset_config.py`:
```py
DATABASE_DIALECT = os.getenv("DATABASE_DIALECT")
DATABASE_USER = os.getenv("DATABASE_USER")
DATABASE_PASSWORD = os.getenv("DATABASE_PASSWORD")
DATABASE_HOST = os.getenv("DATABASE_HOST")
DATABASE_PORT = os.getenv("DATABASE_PORT")
DATABASE_DB = os.getenv("DATABASE_DB")
# The SQLAlchemy connection string.
SQLALCHEMY_DATABASE_URI = (
f"{DATABASE_DIALECT}://"
f"{DATABASE_USER}:{DATABASE_PASSWORD}@"
f"{DATABASE_HOST}:{DATABASE_PORT}/{DATABASE_DB}"
)
```
To use the `SUPERSET_DATABASE_URI` environment variable directly, you would
need to modify the `superset_config.py` file to use it:
```py
SQLALCHEMY_DATABASE_URI = os.getenv("SUPERSET_DATABASE_URI")
```
This change would allow the `SUPERSET_DATABASE_URI` environment variable to
directly set the connection string
<sup>[[1]](https://github.com/apache/superset/blob/master/docker/pythonpath_dev/superset_config.py)</sup>.
<!-- Dosu Comment Footer -->
*To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]