https://prefect.io logo
a

Adam Brusselback

10/04/2021, 7:57 PM
Hey everyone. I have a need to use the PostgresExecute task to run a specific function call, but the host/user/password that it runs for is determined dynamically during flow execution. It seems like this isn't possible due to how the task is setup
k

Kevin Kho

10/04/2021, 8:00 PM
Hey @Adam Brusselback, looks like you are 100% right. There is an outstanding issue for this. We’d certainly welcome a PR if you are interested. Otherwise, my best advice for now would be to subclass the task and override the
run()
method to be configurable.
1
a

Adam Brusselback

10/05/2021, 4:27 AM
Alright, @Kevin Kho with that link I remembered I looked into this already 6 months ago and had commented on that issue (as Tostino). This now is blocking progress for me, so I sat down and fixed the postgres tasks. Will submit a pull request shortly
k

Kevin Kho

10/05/2021, 4:28 AM
I felt this sounded familiar!
a

Adam Brusselback

10/05/2021, 4:34 AM
Hmm, when creating the PR, do I need to do something with the /changes dir?
Ahh well, opened it and will make any changes as requested: https://github.com/PrefectHQ/prefect/pull/5016
k

Kevin Kho

10/05/2021, 4:41 AM
Already looks good to me but I guess we'll let the core team review. The
changes
dir is for you to put a changelog entry and optionally your name
Random thought, is
tuple
annotation only python 3.8 and up? I think it's not available in python 3.7? But I'm not really sure. I think it still needs to be import
from typing import Tuple
a

Adam Brusselback

10/05/2021, 4:44 AM
Hmm, it was already used in the PostgresExecute and that line was unchanged by me, the line I changed from list to tuple, that is a copy paste issue...appreciate you catching that.
k

Kevin Kho

10/05/2021, 4:45 AM
Ah I see