https://prefect.io logo
Title
t

Tadas

01/15/2021, 10:05 PM
Hello, how should I pass defined parameter (prefect input) to a MySQLExecute query param? query expects string 😕
n

nicholas

01/15/2021, 10:22 PM
Hi @Tadas - you could wrap the MySQLExecute task OR extend it such that it would expect a parameter. I don't have a great example for that task in particular but this is how I would do it with the
ShellTask
, which also expects a string:
class Clone(ShellTask):
    def run(self, dynamic_param):
        token = auth_secret
        self.command = f"git clone {dynamic_param}"
        super(Clone, self).run()
But in your case you might instead use
self.query = "{dynamic_param}"
🙂
t

Tadas

01/16/2021, 1:42 PM
Hey, sorry I didn’t get back to you yesterday - I went to sleep. I think I solved it with adding additional StringFormatter task and passing its output to MySQLExecute query 🙂