Hi, Is it possible to override db_name, user and h...
# ask-community
m
Hi, Is it possible to override db_name, user and host values in the runtime for postgres task?
Copy code
postgres_execute = PostgresExecute(    db_name="abc", user="peter", host="my_host", port=5432,)
I have multiple databases (dev, test, demo, +prod db per client), and I need to query/load data into the relevant one. I have a config file and I was hoping I could use Parameter to tell what config line to choose - but it seems like I cannot override those params... What is the recommended approach for such use case?
a
@Maria are you on Prefect Cloud? if so, you could leverage the KV Store for this purpose.
but the easiest would be if you create your own version of Postgres task if you need those attributes to be modified at runtime - here is an example of how this could look like (I haven’t tested this yet) https://gist.github.com/c272f7b6661895f06c5681cacc23a1c0
m
I am. Looking into it now, how can I leverage this?
a
probably the second option with the Gist will be easier and cleaner than KV store
m
Right I see. Yes I think I understand how to use gist option. Thanks a lot!!
🙌 1
k
Anna is right. It would be easier to use a modified version of the postgres task