Hello guys! Sorry for a stupid question, but mayb...
# ask-community
d
Hello guys! Sorry for a stupid question, but maybe someone knows if it is possible to pass
host
Parameter as
MySQLExecute
argument? Pseudo code:
Copy code
from prefect.tasks.mysql.mysql import MySQLExecute
from prefect import Flow, Parameter

example_query = MySQLExecute(
    name="example_query",
    db_name="db name",
    user="some user",
    password="123456",
    port=1234,
    query="select * from example_table;"
)


with Flow("example") as f:
   db_host = Parameter("db_host", default="host_address")
   
   mysql_execute = example_query(host=db_host)
when I execute this pseaudo code, I get this error:
TypeError: __init__() missing 1 required positional argument: 'host'
According to documentation: https://docs.prefect.io/api/latest/tasks/mysql.html#mysqlexecute ,
host
argument is not optional, so by default it is required to be defined in a
MySQLExcute
function. Maybe there is a proper way to pass
host
value to the
MySQLExecute
function?
k
Hi @Domantas! Just a friendly reminder to move the code snippets and details into threads if possible to avoid crowing Slack. Someone asked this question yesterday and I detailed a workaround for him here: https://prefect-community.slack.com/archives/CL09KU1K7/p1617810957152900
d
Hey @Kevin Kho Pardon, it seems that I missed this thread when I searched for similar questions in this channel. Thank you for your response, I'll research answers in that particular thread. Should I delete this post and comment in https://prefect-community.slack.com/archives/CL09KU1K7/p1617810957152900 thread if there would be questions related to this problem?
k
You can keep this it’s fine 🙂. Here to help