Installation
In this section, you will learn how to install the Python SDK in your project.
Install the SDK
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]
Import the SDK into your project
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.
Next steps