We have a useful module that we reuse often called connect that is in bemadb and currently being ported into beist. I've used similar idiom in other sqlalchemy client projects as well and it would be useful to have this functionality just be importable...
We would probably want to generalize this somewhat and maybe pass in **kwargs to configure the engine and allow to pass in sa.MetaData if needed. Also remove if not uri: uri = config.POSTGRES_URI since that is part of the fastapi application config and should not be relied on.
We have a useful module that we reuse often called
connect
that is inbemadb
and currently being ported intobeist
. I've used similar idiom in other sqlalchemy client projects as well and it would be useful to have this functionality just be importable...Example implementation ... https://github.com/cunybpl/bemadb/blob/development/bemadb/cli/connect.py
We would probably want to generalize this somewhat and maybe pass in
**kwargs
to configure the engine and allow to pass insa.MetaData
if needed. Also removeif not uri: uri = config.POSTGRES_URI
since that is part of the fastapi application config and should not be relied on.