Python drivers and ORMs

Python

Prerequisites and CRUD examples for building applications in Python.

The following projects can be used to implement Python applications using the YugabyteDB YSQL API.

Project (* Recommended) Type Support Examples
Yugabyte Psycopg2* Python Driver Full Hello World
CRUD
PostgreSQL Psycopg2 Python Driver Full Hello World
CRUD
SQLAlchemy ORM Full Hello World
CRUD
Django ORM Full Hello World
CRUD

Learn how to establish a connection to a YugabyteDB database and begin basic CRUD operations using the Hello World examples.

For fully-runnable code snippets and explanations of common operations, see the project page CRUD example. Before running CRUD examples, make sure you have installed the prerequisites.

For reference documentation, including using projects with SSL, refer to the drivers and ORMs reference pages.

Prerequisites

To develop Python applications for YugabyteDB, you need the following:

  • Python
    Ensure your system has Python3 installed. To check the version of Python installed, use the following command:

    $ python -V
    

    If not already installed, download and install it from the Python Downloads page.

  • Create a Python project
    Create a python file by adding the .py extension to the filename. A virtual environment is also recommended to keep dependencies required by different projects separate. Make sure pip is also installed in the environment.

  • YugabyteDB cluster