• Start

Languages

/

Python

Installation

In this section, you will learn how to install the Python SDK in your project.

In this section, you will learn how to install the Python SDK in your project.

Install the SurrealDB SDK from PyPI:

pip install surrealdb

If you want pydantic validation and serialization support for RecordID, install the optional extra:

pip install surrealdb[pydantic]

The SDK provides two entry points depending on whether you need synchronous or asynchronous access.

from surrealdb import Surreal

For asynchronous applications using asyncio:

from surrealdb import AsyncSurreal

Both Surreal and AsyncSurreal are factory functions that accept a connection URL and return the appropriate connection class based on the protocol scheme.

Was this page helpful?