Rationale for cursor and connection in the Python database API specification

Viewed 110

Why are both a connection and a cursor needed in the Python database API specification? In the context of SQLite3 these objects seem redundant, as shown:

The main reason for the existence in SQLite3 of both connection and cursor objects seems to be compliance with the Python database API specification v2.0. This specification is applicable not just to SQLite interfaces such as SQLite3 but to a range of databases in Python. From a design perspective, why is it beneficial to differentiate between a connection and a cursor? Are there any conceptual or efficiency advantages?

0 Answers
Related