Getting an established data source, instead of add Postgres

Hi there! I am trying to setup CI for a postgres database. I want a particular python code to run everytime. With that said I was hoping there would be the ability to connect to a predefined datasource instead of remaking it every time. currently I use context.data_sources.add_postgres() but I was hoping there is a get_postgres or something of that nature to not have to re-create.

Thanks!

Hi there,

You don’t need to recreate it each time, once you’ve added the Postgres data source, you can retrieve it using:

data_source_name = "my_new_datasource"
data_source = context.data_sources.get(data_source_name)