ale
10/09/2020, 2:05 PMnicholas
EnvVarSecret
task. More info on that here: https://docs.prefect.io/core/concepts/secrets.html#environment-variablesale
10/09/2020, 2:36 PMnicholas
Class RuntimePostgresFetch(PostgresFetch):
def run(self, user, db_name, password):
# you can also call EnvVarSecret here
# and set the connection details before calling
# super.run
self.user = user
self.password = password
self.db_name = db_name
super(RuntimePostgresFetch, self).run()
^ class extension method
OR
@task
def postgres_fetch_wrapper(user, db_name, password, pg_query):
return PostgresFetch(db_name=db_name, user=user, host='localhost').run(password=pg_pass, query=pg_query, fetch='all')