Update Query
Let's talk about how to UPDATE elements, allowing you to edit specific parts of a recipe or update the entire recipe, completing the CRUD operations in Flask.
Remember how we easily accessed different fields of our model by using the following method:
Recipe.query.get(1).author
Just assign a new value to the attribute:
Recipe.query.get(1).author = "Monica"
db.session.commit()
This command is just to check the functionality of the previous two:
Recipe.query.filter_by(author="Monica").all()
You can edit other fields as well.
Now we know how to READ, CREATE, UPDATE, and DELETE.
¡Gracias por tus comentarios!
Pregunte a AI
Pregunte a AI
Pregunte lo que quiera o pruebe una de las preguntas sugeridas para comenzar nuestra charla
Awesome!
Completion rate improved to 3.85
Update Query
Desliza para mostrar el menú
Let's talk about how to UPDATE elements, allowing you to edit specific parts of a recipe or update the entire recipe, completing the CRUD operations in Flask.
Remember how we easily accessed different fields of our model by using the following method:
Recipe.query.get(1).author
Just assign a new value to the attribute:
Recipe.query.get(1).author = "Monica"
db.session.commit()
This command is just to check the functionality of the previous two:
Recipe.query.filter_by(author="Monica").all()
You can edit other fields as well.
Now we know how to READ, CREATE, UPDATE, and DELETE.
¡Gracias por tus comentarios!