part (iv) marking scheme:
You can get marks here both for describing why ORMs like SQLAlchemy are useful, and for providing code snippets that demonstrate you are familiar with using flask-sqlalchemy
-
ORM stands for Object-Relational Mapping - 1 mark
-
it is an object-oriented way to interact with databases - 1 mark
-
it means you can iteract with the database directly using Python objects instead of need to use explicit MySQL statements - 1 mark
-
you only have to write code and you don't have to be an expert in writing MySQL - 1 mark
-
it helps with code abstraction, so you can change the underlying database without changing a lot of code - 1 mark
-
instead of making explicit database calls in the editing code, we can use statements like
post = Posts.query.filter_by(post_id = post_id).first()
-
up to 2 marks for correct code snippets like the above
-
where Posts is our database model - 1 mark