Florian Guily
05/12/2022, 4:10 PMMySqlExecute
task. I have no error (i had some but i fixed them) but the row i try to insert isn't showing in the table. I can do it with the same user from mysql workbench and the MySqlExecute
task return 1 as expected. I don't understand why, maybe i'm doing something wrong. Here is a code example of my task:
@task
def set_new_date():
logger = prefect.context.get("logger")
new_date = datetime.date.today().strftime("%Y-%m-%d")
query = f"""
INSERT INTO `name`.`table_name` (`name`, `value`) VALUES ('name', '{new_date}');
"""
result = MySQLExecute(
db_name="name",
user="user",
password="pwd",
host="host",
port=3306,
query=query).run()
<http://logger.info|logger.info>("New date is {}".format(new_date))
<http://logger.info|logger.info>("Query results is {}".format(result))
Kevin Kho
MySQLExecute
outside of a task?Florian Guily
05/12/2022, 4:26 PMquery = f"""
INSERT INTO `name`.`table_name` (`name`, `value`) VALUES ('name', '2022-05-12');
"""
flow.add_task(MySQLExecute(
db_name="name",
user="user",
password="pwd",
host="host",
port=3306,
query=query))
And same thing. The task is marked as successful in the logs but the row is not showing upKevin Kho
Anna Geller
Florian Guily
05/13/2022, 10:04 AMAnna Geller