---
title: "DB-API 2.0"
description: "DB-API 2.0 is a standardized Python interface for accessing relational databases."
canonical: "https://motherduck.com/glossary/db-api-2-0/"
related:
  - title: "Why Python Developers Need DuckDB (And Not Just Another DataFrame Library)"
    url: "https://motherduck.com/blog/python-duckdb-vs-dataframe-libraries/"
  - title: "MotherDuck Interfaces | MotherDuck Docs"
    url: "https://motherduck.com/docs/getting-started/interfaces/"
  - title: "DuckLake: The Definitive Guide — Live Author Q&A with Matt Martin & Alex Monahan | MotherDuck"
    url: "https://motherduck.com/videos/ducklake-definitive-guide-oreilly-book/"
gated_asset:
  title: "DuckLake: The Lakehouse Table Format"
  url: "https://motherduck.com/lp/ducklake-lakehouse-table-format-book-full/"
---

# DB-API 2.0

> DB-API 2.0 is a standardized Python interface for accessing relational databases.

[DB-API 2.0](https://peps.python.org/pep-0249/) is a standardized Python interface for accessing relational databases. It defines a set of methods and behaviors that database adapters should implement, allowing Python programmers to write code that can work with different database systems without major modifications. This specification includes guidelines for connecting to databases, executing SQL queries, and handling result sets. By adhering to DB-API 2.0, database libraries ensure compatibility and interoperability across various database management systems, making it easier for developers to switch between databases or work with multiple databases in a single project. Popular database adapters like `psycopg2` for PostgreSQL and `sqlite3` for SQLite follow this specification, providing a consistent experience for Python developers working with relational data.

<glossary-callout guide="duckdb-book-brief" />