We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
[BUG]  basic-auth alembic migration crash on remote database
### Issues Policy acknowledgement

- [X] I have read and agree to submit bug reports in accordance with the [issues policy](https://www.github.com/mlflow/mlflow/blob/master/ISSUE_POLICY.md)

### Willingness to contribute

Yes. I can contribute a fix for this bug independently.

### MLflow version

- Client: 1.5.0
- Tracking server: 1.5.0


### System information

- **Debian GNU/Linux 10 (buster)**:
- **Python 3.8.17 **:

- **SQLAlchemy version: 2.0.19**

### Describe the problem

Alembic migration for the basic-auth app crashes due to obfuscated password being passed to the alembic config

This bug seems to be related to the SQLAlchemy version, migration works with SQLAlchemy 1.4.19 but not with 2.0.19, seems like they change the behaviour of the str representation of url's.

### Tracking information

<!-- PLEASE KEEP BACKTICKS AND CHECK PREVIEW -->
```shell
REPLACE_ME
```


### Code to reproduce issue

<!-- PLEASE KEEP BACKTICKS AND CHECK PREVIEW -->
```
python -m mlflow.server.auth db upgrade --url 'postgresql://database_user:database_password@host:5432/database_name'
```


### Stack trace

<!-- PLEASE KEEP BACKTICKS AND CHECK PREVIEW -->
```
Traceback (most recent call last):
  File "/home/turuania/mlflow_test/env/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 145, in __init__
    self._dbapi_connection = engine.raw_connection()
  File "/home/turuania/mlflow_test/env/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 3288, in raw_connection
    return self.pool.connect()
  File "/home/turuania/mlflow_test/env/lib/python3.8/site-packages/sqlalchemy/pool/base.py", line 452, in connect
    return _ConnectionFairy._checkout(self)
  File "/home/turuania/mlflow_test/env/lib/python3.8/site-packages/sqlalchemy/pool/base.py", line 1267, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/turuania/mlflow_test/env/lib/python3.8/site-packages/sqlalchemy/pool/base.py", line 716, in checkout
    rec = pool._do_get()
  File "/home/turuania/mlflow_test/env/lib/python3.8/site-packages/sqlalchemy/pool/impl.py", line 284, in _do_get
    return self._create_connection()
  File "/home/turuania/mlflow_test/env/lib/python3.8/site-packages/sqlalchemy/pool/base.py", line 393, in _create_connection
    return _ConnectionRecord(self)
  File "/home/turuania/mlflow_test/env/lib/python3.8/site-packages/sqlalchemy/pool/base.py", line 678, in __init__
    self.__connect()
  File "/home/turuania/mlflow_test/env/lib/python3.8/site-packages/sqlalchemy/pool/base.py", line 903, in __connect
    pool.logger.debug("Error on connect(): %s", e)
  File "/home/turuania/mlflow_test/env/lib/python3.8/site-packages/sqlalchemy/util/langhelpers.py", line 147, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/turuania/mlflow_test/env/lib/python3.8/site-packages/sqlalchemy/pool/base.py", line 898, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
  File "/home/turuania/mlflow_test/env/lib/python3.8/site-packages/sqlalchemy/engine/create.py", line 637, in connect
    return dialect.connect(*cargs, **cparams)
  File "/home/turuania/mlflow_test/env/lib/python3.8/site-packages/sqlalchemy/engine/default.py", line 615, in connect
    return self.loaded_dbapi.connect(*cargs, **cparams)
  File "/home/turuania/mlflow_test/env/lib/python3.8/site-packages/psycopg2/__init__.py", line 122, in connect
    conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
sqlalchemy.exc.OperationalError: (psycopg2.OperationalError) connection to server at "host" (host ip), port 5432 failed: FATAL:  password authentication failed for user "db_user"
connection to server at "host" (host_ip), port 5432 failed: FATAL:  password authentication failed for user "db_user"


The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.8/runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/local/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/home/turuania/mlflow_test/env/lib/python3.8/site-packages/mlflow/server/auth/__main__.py", line 5, in <module>
    commands()
  File "/home/turuania/mlflow_test/env/lib/python3.8/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
  File "/home/turuania/mlflow_test/env/lib/python3.8/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
  File "/home/turuania/mlflow_test/env/lib/python3.8/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/turuania/mlflow_test/env/lib/python3.8/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/turuania/mlflow_test/env/lib/python3.8/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/turuania/mlflow_test/env/lib/python3.8/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "/home/turuania/mlflow_test/env/lib/python3.8/site-packages/mlflow/server/auth/db/cli.py", line 19, in upgrade
    utils.migrate(engine, revision)
  File "/home/turuania/mlflow_test/env/lib/python3.8/site-packages/mlflow/server/auth/db/utils.py", line 28, in migrate
    upgrade(alembic_cfg, revision)
  File "/home/turuania/mlflow_test/env/lib/python3.8/site-packages/alembic/command.py", line 385, in upgrade
    script.run_env()
  File "/home/turuania/mlflow_test/env/lib/python3.8/site-packages/alembic/script/base.py", line 578, in run_env
    util.load_python_file(self.dir, "env.py")
  File "/home/turuania/mlflow_test/env/lib/python3.8/site-packages/alembic/util/pyfiles.py", line 93, in load_python_file
    module = load_module_py(module_id, path)
  File "/home/turuania/mlflow_test/env/lib/python3.8/site-packages/alembic/util/pyfiles.py", line 109, in load_module_py
    spec.loader.exec_module(module)  # type: ignore
  File "<frozen importlib._bootstrap_external>", line 843, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/home/turuania/mlflow_test/env/lib/python3.8/site-packages/mlflow/server/auth/db/migrations/env.py", line 79, in <module>
    run_migrations_online()
  File "/home/turuania/mlflow_test/env/lib/python3.8/site-packages/mlflow/server/auth/db/migrations/env.py", line 69, in run_migrations_online
    with connectable.connect() as connection:
  File "/home/turuania/mlflow_test/env/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 3264, in connect
    return self._connection_cls(self)
  File "/home/turuania/mlflow_test/env/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 147, in __init__
    Connection._handle_dbapi_exception_noconnection(
  File "/home/turuania/mlflow_test/env/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 2426, in _handle_dbapi_exception_noconnection
    raise sqlalchemy_exception.with_traceback(exc_info[2]) from e
  File "/home/turuania/mlflow_test/env/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 145, in __init__
    self._dbapi_connection = engine.raw_connection()
  File "/home/turuania/mlflow_test/env/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 3288, in raw_connection
    return self.pool.connect()
  File "/home/turuania/mlflow_test/env/lib/python3.8/site-packages/sqlalchemy/pool/base.py", line 452, in connect
    return _ConnectionFairy._checkout(self)
  File "/home/turuania/mlflow_test/env/lib/python3.8/site-packages/sqlalchemy/pool/base.py", line 1267, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/turuania/mlflow_test/env/lib/python3.8/site-packages/sqlalchemy/pool/base.py", line 716, in checkout
    rec = pool._do_get()
  File "/home/turuania/mlflow_test/env/lib/python3.8/site-packages/sqlalchemy/pool/impl.py", line 284, in _do_get
    return self._create_connection()
  File "/home/turuania/mlflow_test/env/lib/python3.8/site-packages/sqlalchemy/pool/base.py", line 393, in _create_connection
    return _ConnectionRecord(self)
  File "/home/turuania/mlflow_test/env/lib/python3.8/site-packages/sqlalchemy/pool/base.py", line 678, in __init__
    self.__connect()
  File "/home/turuania/mlflow_test/env/lib/python3.8/site-packages/sqlalchemy/pool/base.py", line 903, in __connect
    pool.logger.debug("Error on connect(): %s", e)
  File "/home/turuania/mlflow_test/env/lib/python3.8/site-packages/sqlalchemy/util/langhelpers.py", line 147, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/turuania/mlflow_test/env/lib/python3.8/site-packages/sqlalchemy/pool/base.py", line 898, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
  File "/home/turuania/mlflow_test/env/lib/python3.8/site-packages/sqlalchemy/engine/create.py", line 637, in connect
    return dialect.connect(*cargs, **cparams)
  File "/home/turuania/mlflow_test/env/lib/python3.8/site-packages/sqlalchemy/engine/default.py", line 615, in connect
    return self.loaded_dbapi.connect(*cargs, **cparams)
  File "/home/turuania/mlflow_test/env/lib/python3.8/site-packages/psycopg2/__init__.py", line 122, in connect
    conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
sqlalchemy.exc.OperationalError: (psycopg2.OperationalError) connection to server at "host" (host ip), port 5432 failed: FATAL:  password authentication failed for user "db_user"
connection to server at "host" (host_ip), port 5432 failed: FATAL:  password authentication failed for user "db_user"

(Background on this error at: https://sqlalche.me/e/20/e3q8)
```


### Other info / logs

<!-- PLEASE KEEP BACKTICKS AND CHECK PREVIEW -->
```
REPLACE_ME
```


### What component(s) does this bug affect?

- [ ] `area/artifacts`: Artifact stores and artifact logging
- [ ] `area/build`: Build and test infrastructure for MLflow
- [ ] `area/docs`: MLflow documentation pages
- [ ] `area/examples`: Example code
- [ ] `area/gateway`: AI Gateway service, Gateway client APIs, third-party Gateway integrations
- [ ] `area/model-registry`: Model Registry service, APIs, and the fluent client calls for Model Registry
- [ ] `area/models`: MLmodel format, model serialization/deserialization, flavors
- [ ] `area/recipes`: Recipes, Recipe APIs, Recipe configs, Recipe Templates
- [ ] `area/projects`: MLproject format, project running backends
- [ ] `area/scoring`: MLflow Model server, model deployment tools, Spark UDFs
- [X] `area/server-infra`: MLflow Tracking server backend
- [ ] `area/tracking`: Tracking Service, tracking client APIs, autologging

### What interface(s) does this bug affect?

- [ ] `area/uiux`: Front-end, user experience, plotting, JavaScript, JavaScript dev server
- [ ] `area/docker`: Docker use across MLflow's components, such as MLflow Projects and MLflow Models
- [X] `area/sqlalchemy`: Use of SQLAlchemy in the Tracking Service or Model Registry
- [ ] `area/windows`: Windows support

### What language(s) does this bug affect?

- [ ] `language/r`: R APIs and clients
- [ ] `language/java`: Java APIs and clients
- [ ] `language/new`: Proposals for new client languages

### What integration(s) does this bug affect?

- [ ] `integrations/azure`: Azure and Azure ML integrations
- [ ] `integrations/sagemaker`: SageMaker integrations
- [ ] `integrations/databricks`: Databricks integrations

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `mlflow/server/auth/db/utils.py`
Content:
```
1 from pathlib import Path
2 
3 from sqlalchemy.engine.base import Engine
4 from alembic.command import upgrade
5 from alembic.config import Config
6 from alembic.script import ScriptDirectory
7 from alembic.migration import MigrationContext
8 
9 
10 def _get_alembic_dir() -> str:
11     return Path(__file__).parent / "migrations"
12 
13 
14 def _get_alembic_config(url: str) -> Config:
15     alembic_dir = _get_alembic_dir()
16     alembic_ini_path = alembic_dir / "alembic.ini"
17     alembic_cfg = Config(alembic_ini_path)
18     alembic_cfg.set_main_option("script_location", str(alembic_dir))
19     alembic_cfg.set_main_option("sqlalchemy.url", url)
20     return alembic_cfg
21 
22 
23 def migrate(engine: Engine, revision: str) -> None:
24     alembic_cfg = _get_alembic_config(str(engine.url))
25     with engine.begin() as conn:
26         alembic_cfg.attributes["connection"] = conn
27         upgrade(alembic_cfg, revision)
28 
29 
30 def migrate_if_needed(engine: Engine, revision: str) -> None:
31     alembic_cfg = _get_alembic_config(str(engine.url))
32     script_dir = ScriptDirectory.from_config(alembic_cfg)
33     with engine.begin() as conn:
34         context = MigrationContext.configure(conn)
35         if context.get_current_revision() != script_dir.get_current_head():
36             upgrade(alembic_cfg, revision)
37
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/mlflow/server/auth/db/utils.py b/mlflow/server/auth/db/utils.py
--- a/mlflow/server/auth/db/utils.py
+++ b/mlflow/server/auth/db/utils.py
@@ -21,7 +21,7 @@
 
 
 def migrate(engine: Engine, revision: str) -> None:
-    alembic_cfg = _get_alembic_config(str(engine.url))
+    alembic_cfg = _get_alembic_config(engine.url.render_as_string(hide_password=False))
     with engine.begin() as conn:
         alembic_cfg.attributes["connection"] = conn
         upgrade(alembic_cfg, revision)

{"golden_diff": "diff --git a/mlflow/server/auth/db/utils.py b/mlflow/server/auth/db/utils.py\n--- a/mlflow/server/auth/db/utils.py\n+++ b/mlflow/server/auth/db/utils.py\n@@ -21,7 +21,7 @@\n \n \n def migrate(engine: Engine, revision: str) -> None:\n-    alembic_cfg = _get_alembic_config(str(engine.url))\n+    alembic_cfg = _get_alembic_config(engine.url.render_as_string(hide_password=False))\n     with engine.begin() as conn:\n         alembic_cfg.attributes[\"connection\"] = conn\n         upgrade(alembic_cfg, revision)\n", "issue": "[BUG]  basic-auth alembic migration crash on remote database\n### Issues Policy acknowledgement\n\n- [X] I have read and agree to submit bug reports in accordance with the [issues policy](https://www.github.com/mlflow/mlflow/blob/master/ISSUE_POLICY.md)\n\n### Willingness to contribute\n\nYes. I can contribute a fix for this bug independently.\n\n### MLflow version\n\n- Client: 1.5.0\r\n- Tracking server: 1.5.0\r\n\n\n### System information\n\n- **Debian GNU/Linux 10 (buster)**:\r\n- **Python 3.8.17 **:\r\n\r\n- **SQLAlchemy version: 2.0.19**\n\n### Describe the problem\n\nAlembic migration for the basic-auth app crashes due to obfuscated password being passed to the alembic config\r\n\r\nThis bug seems to be related to the SQLAlchemy version, migration works with SQLAlchemy 1.4.19 but not with 2.0.19, seems like they change the behaviour of the str representation of url's.\n\n### Tracking information\n\n<!-- PLEASE KEEP BACKTICKS AND CHECK PREVIEW -->\r\n```shell\r\nREPLACE_ME\r\n```\r\n\n\n### Code to reproduce issue\n\n<!-- PLEASE KEEP BACKTICKS AND CHECK PREVIEW -->\r\n```\r\npython -m mlflow.server.auth db upgrade --url 'postgresql://database_user:database_password@host:5432/database_name'\r\n```\r\n\n\n### Stack trace\n\n<!-- PLEASE KEEP BACKTICKS AND CHECK PREVIEW -->\r\n```\r\nTraceback (most recent call last):\r\n  File \"/home/turuania/mlflow_test/env/lib/python3.8/site-packages/sqlalchemy/engine/base.py\", line 145, in __init__\r\n    self._dbapi_connection = engine.raw_connection()\r\n  File \"/home/turuania/mlflow_test/env/lib/python3.8/site-packages/sqlalchemy/engine/base.py\", line 3288, in raw_connection\r\n    return self.pool.connect()\r\n  File \"/home/turuania/mlflow_test/env/lib/python3.8/site-packages/sqlalchemy/pool/base.py\", line 452, in connect\r\n    return _ConnectionFairy._checkout(self)\r\n  File \"/home/turuania/mlflow_test/env/lib/python3.8/site-packages/sqlalchemy/pool/base.py\", line 1267, in _checkout\r\n    fairy = _ConnectionRecord.checkout(pool)\r\n  File \"/home/turuania/mlflow_test/env/lib/python3.8/site-packages/sqlalchemy/pool/base.py\", line 716, in checkout\r\n    rec = pool._do_get()\r\n  File \"/home/turuania/mlflow_test/env/lib/python3.8/site-packages/sqlalchemy/pool/impl.py\", line 284, in _do_get\r\n    return self._create_connection()\r\n  File \"/home/turuania/mlflow_test/env/lib/python3.8/site-packages/sqlalchemy/pool/base.py\", line 393, in _create_connection\r\n    return _ConnectionRecord(self)\r\n  File \"/home/turuania/mlflow_test/env/lib/python3.8/site-packages/sqlalchemy/pool/base.py\", line 678, in __init__\r\n    self.__connect()\r\n  File \"/home/turuania/mlflow_test/env/lib/python3.8/site-packages/sqlalchemy/pool/base.py\", line 903, in __connect\r\n    pool.logger.debug(\"Error on connect(): %s\", e)\r\n  File \"/home/turuania/mlflow_test/env/lib/python3.8/site-packages/sqlalchemy/util/langhelpers.py\", line 147, in __exit__\r\n    raise exc_value.with_traceback(exc_tb)\r\n  File \"/home/turuania/mlflow_test/env/lib/python3.8/site-packages/sqlalchemy/pool/base.py\", line 898, in __connect\r\n    self.dbapi_connection = connection = pool._invoke_creator(self)\r\n  File \"/home/turuania/mlflow_test/env/lib/python3.8/site-packages/sqlalchemy/engine/create.py\", line 637, in connect\r\n    return dialect.connect(*cargs, **cparams)\r\n  File \"/home/turuania/mlflow_test/env/lib/python3.8/site-packages/sqlalchemy/engine/default.py\", line 615, in connect\r\n    return self.loaded_dbapi.connect(*cargs, **cparams)\r\n  File \"/home/turuania/mlflow_test/env/lib/python3.8/site-packages/psycopg2/__init__.py\", line 122, in connect\r\n    conn = _connect(dsn, connection_factory=connection_factory, **kwasync)\r\nsqlalchemy.exc.OperationalError: (psycopg2.OperationalError) connection to server at \"host\" (host ip), port 5432 failed: FATAL:  password authentication failed for user \"db_user\"\r\nconnection to server at \"host\" (host_ip), port 5432 failed: FATAL:  password authentication failed for user \"db_user\"\r\n\r\n\r\nThe above exception was the direct cause of the following exception:\r\n\r\nTraceback (most recent call last):\r\n  File \"/usr/local/lib/python3.8/runpy.py\", line 194, in _run_module_as_main\r\n    return _run_code(code, main_globals, None,\r\n  File \"/usr/local/lib/python3.8/runpy.py\", line 87, in _run_code\r\n    exec(code, run_globals)\r\n  File \"/home/turuania/mlflow_test/env/lib/python3.8/site-packages/mlflow/server/auth/__main__.py\", line 5, in <module>\r\n    commands()\r\n  File \"/home/turuania/mlflow_test/env/lib/python3.8/site-packages/click/core.py\", line 1157, in __call__\r\n    return self.main(*args, **kwargs)\r\n  File \"/home/turuania/mlflow_test/env/lib/python3.8/site-packages/click/core.py\", line 1078, in main\r\n    rv = self.invoke(ctx)\r\n  File \"/home/turuania/mlflow_test/env/lib/python3.8/site-packages/click/core.py\", line 1688, in invoke\r\n    return _process_result(sub_ctx.command.invoke(sub_ctx))\r\n  File \"/home/turuania/mlflow_test/env/lib/python3.8/site-packages/click/core.py\", line 1688, in invoke\r\n    return _process_result(sub_ctx.command.invoke(sub_ctx))\r\n  File \"/home/turuania/mlflow_test/env/lib/python3.8/site-packages/click/core.py\", line 1434, in invoke\r\n    return ctx.invoke(self.callback, **ctx.params)\r\n  File \"/home/turuania/mlflow_test/env/lib/python3.8/site-packages/click/core.py\", line 783, in invoke\r\n    return __callback(*args, **kwargs)\r\n  File \"/home/turuania/mlflow_test/env/lib/python3.8/site-packages/mlflow/server/auth/db/cli.py\", line 19, in upgrade\r\n    utils.migrate(engine, revision)\r\n  File \"/home/turuania/mlflow_test/env/lib/python3.8/site-packages/mlflow/server/auth/db/utils.py\", line 28, in migrate\r\n    upgrade(alembic_cfg, revision)\r\n  File \"/home/turuania/mlflow_test/env/lib/python3.8/site-packages/alembic/command.py\", line 385, in upgrade\r\n    script.run_env()\r\n  File \"/home/turuania/mlflow_test/env/lib/python3.8/site-packages/alembic/script/base.py\", line 578, in run_env\r\n    util.load_python_file(self.dir, \"env.py\")\r\n  File \"/home/turuania/mlflow_test/env/lib/python3.8/site-packages/alembic/util/pyfiles.py\", line 93, in load_python_file\r\n    module = load_module_py(module_id, path)\r\n  File \"/home/turuania/mlflow_test/env/lib/python3.8/site-packages/alembic/util/pyfiles.py\", line 109, in load_module_py\r\n    spec.loader.exec_module(module)  # type: ignore\r\n  File \"<frozen importlib._bootstrap_external>\", line 843, in exec_module\r\n  File \"<frozen importlib._bootstrap>\", line 219, in _call_with_frames_removed\r\n  File \"/home/turuania/mlflow_test/env/lib/python3.8/site-packages/mlflow/server/auth/db/migrations/env.py\", line 79, in <module>\r\n    run_migrations_online()\r\n  File \"/home/turuania/mlflow_test/env/lib/python3.8/site-packages/mlflow/server/auth/db/migrations/env.py\", line 69, in run_migrations_online\r\n    with connectable.connect() as connection:\r\n  File \"/home/turuania/mlflow_test/env/lib/python3.8/site-packages/sqlalchemy/engine/base.py\", line 3264, in connect\r\n    return self._connection_cls(self)\r\n  File \"/home/turuania/mlflow_test/env/lib/python3.8/site-packages/sqlalchemy/engine/base.py\", line 147, in __init__\r\n    Connection._handle_dbapi_exception_noconnection(\r\n  File \"/home/turuania/mlflow_test/env/lib/python3.8/site-packages/sqlalchemy/engine/base.py\", line 2426, in _handle_dbapi_exception_noconnection\r\n    raise sqlalchemy_exception.with_traceback(exc_info[2]) from e\r\n  File \"/home/turuania/mlflow_test/env/lib/python3.8/site-packages/sqlalchemy/engine/base.py\", line 145, in __init__\r\n    self._dbapi_connection = engine.raw_connection()\r\n  File \"/home/turuania/mlflow_test/env/lib/python3.8/site-packages/sqlalchemy/engine/base.py\", line 3288, in raw_connection\r\n    return self.pool.connect()\r\n  File \"/home/turuania/mlflow_test/env/lib/python3.8/site-packages/sqlalchemy/pool/base.py\", line 452, in connect\r\n    return _ConnectionFairy._checkout(self)\r\n  File \"/home/turuania/mlflow_test/env/lib/python3.8/site-packages/sqlalchemy/pool/base.py\", line 1267, in _checkout\r\n    fairy = _ConnectionRecord.checkout(pool)\r\n  File \"/home/turuania/mlflow_test/env/lib/python3.8/site-packages/sqlalchemy/pool/base.py\", line 716, in checkout\r\n    rec = pool._do_get()\r\n  File \"/home/turuania/mlflow_test/env/lib/python3.8/site-packages/sqlalchemy/pool/impl.py\", line 284, in _do_get\r\n    return self._create_connection()\r\n  File \"/home/turuania/mlflow_test/env/lib/python3.8/site-packages/sqlalchemy/pool/base.py\", line 393, in _create_connection\r\n    return _ConnectionRecord(self)\r\n  File \"/home/turuania/mlflow_test/env/lib/python3.8/site-packages/sqlalchemy/pool/base.py\", line 678, in __init__\r\n    self.__connect()\r\n  File \"/home/turuania/mlflow_test/env/lib/python3.8/site-packages/sqlalchemy/pool/base.py\", line 903, in __connect\r\n    pool.logger.debug(\"Error on connect(): %s\", e)\r\n  File \"/home/turuania/mlflow_test/env/lib/python3.8/site-packages/sqlalchemy/util/langhelpers.py\", line 147, in __exit__\r\n    raise exc_value.with_traceback(exc_tb)\r\n  File \"/home/turuania/mlflow_test/env/lib/python3.8/site-packages/sqlalchemy/pool/base.py\", line 898, in __connect\r\n    self.dbapi_connection = connection = pool._invoke_creator(self)\r\n  File \"/home/turuania/mlflow_test/env/lib/python3.8/site-packages/sqlalchemy/engine/create.py\", line 637, in connect\r\n    return dialect.connect(*cargs, **cparams)\r\n  File \"/home/turuania/mlflow_test/env/lib/python3.8/site-packages/sqlalchemy/engine/default.py\", line 615, in connect\r\n    return self.loaded_dbapi.connect(*cargs, **cparams)\r\n  File \"/home/turuania/mlflow_test/env/lib/python3.8/site-packages/psycopg2/__init__.py\", line 122, in connect\r\n    conn = _connect(dsn, connection_factory=connection_factory, **kwasync)\r\nsqlalchemy.exc.OperationalError: (psycopg2.OperationalError) connection to server at \"host\" (host ip), port 5432 failed: FATAL:  password authentication failed for user \"db_user\"\r\nconnection to server at \"host\" (host_ip), port 5432 failed: FATAL:  password authentication failed for user \"db_user\"\r\n\r\n(Background on this error at: https://sqlalche.me/e/20/e3q8)\r\n```\r\n\n\n### Other info / logs\n\n<!-- PLEASE KEEP BACKTICKS AND CHECK PREVIEW -->\r\n```\r\nREPLACE_ME\r\n```\r\n\n\n### What component(s) does this bug affect?\n\n- [ ] `area/artifacts`: Artifact stores and artifact logging\n- [ ] `area/build`: Build and test infrastructure for MLflow\n- [ ] `area/docs`: MLflow documentation pages\n- [ ] `area/examples`: Example code\n- [ ] `area/gateway`: AI Gateway service, Gateway client APIs, third-party Gateway integrations\n- [ ] `area/model-registry`: Model Registry service, APIs, and the fluent client calls for Model Registry\n- [ ] `area/models`: MLmodel format, model serialization/deserialization, flavors\n- [ ] `area/recipes`: Recipes, Recipe APIs, Recipe configs, Recipe Templates\n- [ ] `area/projects`: MLproject format, project running backends\n- [ ] `area/scoring`: MLflow Model server, model deployment tools, Spark UDFs\n- [X] `area/server-infra`: MLflow Tracking server backend\n- [ ] `area/tracking`: Tracking Service, tracking client APIs, autologging\n\n### What interface(s) does this bug affect?\n\n- [ ] `area/uiux`: Front-end, user experience, plotting, JavaScript, JavaScript dev server\n- [ ] `area/docker`: Docker use across MLflow's components, such as MLflow Projects and MLflow Models\n- [X] `area/sqlalchemy`: Use of SQLAlchemy in the Tracking Service or Model Registry\n- [ ] `area/windows`: Windows support\n\n### What language(s) does this bug affect?\n\n- [ ] `language/r`: R APIs and clients\n- [ ] `language/java`: Java APIs and clients\n- [ ] `language/new`: Proposals for new client languages\n\n### What integration(s) does this bug affect?\n\n- [ ] `integrations/azure`: Azure and Azure ML integrations\n- [ ] `integrations/sagemaker`: SageMaker integrations\n- [ ] `integrations/databricks`: Databricks integrations\n", "before_files": [{"content": "from pathlib import Path\n\nfrom sqlalchemy.engine.base import Engine\nfrom alembic.command import upgrade\nfrom alembic.config import Config\nfrom alembic.script import ScriptDirectory\nfrom alembic.migration import MigrationContext\n\n\ndef _get_alembic_dir() -> str:\n    return Path(__file__).parent / \"migrations\"\n\n\ndef _get_alembic_config(url: str) -> Config:\n    alembic_dir = _get_alembic_dir()\n    alembic_ini_path = alembic_dir / \"alembic.ini\"\n    alembic_cfg = Config(alembic_ini_path)\n    alembic_cfg.set_main_option(\"script_location\", str(alembic_dir))\n    alembic_cfg.set_main_option(\"sqlalchemy.url\", url)\n    return alembic_cfg\n\n\ndef migrate(engine: Engine, revision: str) -> None:\n    alembic_cfg = _get_alembic_config(str(engine.url))\n    with engine.begin() as conn:\n        alembic_cfg.attributes[\"connection\"] = conn\n        upgrade(alembic_cfg, revision)\n\n\ndef migrate_if_needed(engine: Engine, revision: str) -> None:\n    alembic_cfg = _get_alembic_config(str(engine.url))\n    script_dir = ScriptDirectory.from_config(alembic_cfg)\n    with engine.begin() as conn:\n        context = MigrationContext.configure(conn)\n        if context.get_current_revision() != script_dir.get_current_head():\n            upgrade(alembic_cfg, revision)\n", "path": "mlflow/server/auth/db/utils.py"}], "after_files": [{"content": "from pathlib import Path\n\nfrom sqlalchemy.engine.base import Engine\nfrom alembic.command import upgrade\nfrom alembic.config import Config\nfrom alembic.script import ScriptDirectory\nfrom alembic.migration import MigrationContext\n\n\ndef _get_alembic_dir() -> str:\n    return Path(__file__).parent / \"migrations\"\n\n\ndef _get_alembic_config(url: str) -> Config:\n    alembic_dir = _get_alembic_dir()\n    alembic_ini_path = alembic_dir / \"alembic.ini\"\n    alembic_cfg = Config(alembic_ini_path)\n    alembic_cfg.set_main_option(\"script_location\", str(alembic_dir))\n    alembic_cfg.set_main_option(\"sqlalchemy.url\", url)\n    return alembic_cfg\n\n\ndef migrate(engine: Engine, revision: str) -> None:\n    alembic_cfg = _get_alembic_config(engine.url.render_as_string(hide_password=False))\n    with engine.begin() as conn:\n        alembic_cfg.attributes[\"connection\"] = conn\n        upgrade(alembic_cfg, revision)\n\n\ndef migrate_if_needed(engine: Engine, revision: str) -> None:\n    alembic_cfg = _get_alembic_config(str(engine.url))\n    script_dir = ScriptDirectory.from_config(alembic_cfg)\n    with engine.begin() as conn:\n        context = MigrationContext.configure(conn)\n        if context.get_current_revision() != script_dir.get_current_head():\n            upgrade(alembic_cfg, revision)\n", "path": "mlflow/server/auth/db/utils.py"}]}