databases icon indicating copy to clipboard operation
databases copied to clipboard

No way to dynamically provide database credentials

Open wichert opened this issue 5 years ago • 1 comments

I need to deal with databases that automatically rotate passwords for users. This results in connection errors when Database tries to reconnect after the password it used before has been replaced. To support this use case it would be useful to allow providing a callable to generate a DatabaseURL instead passing in a DatabaseURL directly.

I tried to do this by using a custom DatabaseURL-derived class, but this is failing because both Database.init and PostgresBackend.init always do DatabaseURL(url), even if url is already a DatabaseURL instance.

wichert avatar Dec 31 '20 20:12 wichert

I noticed #250 makes this possible for asyncpg, which happens to be enough for my needs. Would it be possible to make a new release with that change?

wichert avatar Dec 31 '20 20:12 wichert