its ORM (object-relational mapper) capabilities. • This provides an easy-to-use method for accessing the contents of a database. • With an ORM’d class, we can just retrieve instances from a database, work with them ignoring the database aspect, and then commit them back to the database when we’re done.
easy to make inefficient. • In the previous example, the entire contents of the TodoItem object are retrieved from the database, even though only the done column is used. • We would like to be able to make updates directly on the database server, and to fetch only the necessary columns for a large operation.
maps directly from Python statements to SQL queries. • This allows SQL statements to be specified in such a way that they can be verified as part of the Python code, e.g. by a linter. • This permits selective transfers of data, and mutating operations done purely inside the DBMS.