Working with the Python DB-API
The DuckDB Python client also provides another API for interacting with DuckDB databases: the Python DB-API. This is an interface that is compliant with the Python Database API Specification v2.0 (DB-API 2.0), which is described by PEP 249 (https://peps.python.org/pep-0249). The DB-API specification describes a standardized interface for accessing databases within Python, which has become a commonly used standard for Python database client packages. By encouraging conformity of API interfaces across different Python database libraries, Python code that targets this interface is more readily understood and more portable across databases, leading to a general increase in the availability of database connectivity in the Python ecosystem.
If you’re developing a Python application that will potentially need to connect to a range of data sources, you will likely want to use the DB-API where possible, as the use of a standardized interface will enable...