pypi / surrealdb
surrealdb
What changed in surrealdb 1 to 3, from its official release notes, upgrade guides and advisories. Sources checked 2026-12-05.
16 breaking4 security63 new APIs and options5 behavior and defaults8 fixes and other
See which of these apply to your code, ranked, in your agent:
npx @unstale/cli initsurrealdb 378 changes
Breaking changes 13
A datetime.date is now sent as a SurrealDB date; a naive datetime.time is sent as a SurrealDB time.
Calls DEFINE API endpoints and returns an ApiResponse; requires SurrealDB 3.0 or later and the define_api capability.
A string passed to select() is always treated as a table name; pass a RecordID or StringRecordId to select a record.
The SDK sends Decimal values in plain notation, as required by SurrealDB 4.0.
The embedded engine cannot open file:// or surrealkv:// databases written by a 3.x engine; export with a 3.x surreal binary and import into a new database to keep the data.
A plain string is always a table name, not a parsed record id or range; use StringRecordId or RecordID to target records.
Passing a compiled regular expression now raises TypeError and points callers to Regex because its former CBOR tag is refused by SurrealDB.
Responses are validated as strictly as SurrealDB 4.0 requests; payloads that do not hold a SurrealDB value raise UnexpectedResponseError.
Rust 1.95 or later is required to build the embedded extension from source.
The default client IP detection method changes from none to socket.
The environment variable entry for naming a model with ml export is removed from the documented command environment variables.
The documented version setting for ml export is removed.
The SDK checks the server version on connect and refuses versions older than 2.0 or newer than 4.x; set version_check=False to skip the check.
Security 4
The SDK adds revoke() among its session and token operations.
Adds a start capability setting to deny arbitrary queries for selected user groups, or all groups when no value is given; specifically allowed groups take precedence.
Adds a start capability setting to deny all HTTP routes except those allowed, or to deny only a listed set of routes.
Adds a start capability setting to deny all RPC methods except those allowed, or to deny only a listed set of methods.
New APIs and options 58
Pass auth= when connecting to sign in; the connection renews its access token before it expires.
The SDK supports the BigDecimal type.
The SDK supports the cbor.2 format.
Use db.api() for DEFINE API endpoints.
Send several statements as one transaction with db.batch().
Use db.begin_transaction() as a context manager.
Remote connections add db.export().
Remote connections add db.export_to().
The SDK adds db.gql().
The SDK adds db.graphql().
Checks the server's health endpoint and raises ConnectionUnavailableError if the server is unhealthy or unreachable.
Remote connections add db.import_().
Checks whether the connected server supports a feature; unsupported features are rejected before a request is sent.
Exchanges a refresh token for a new token pair, authenticates with the new access token and defaults to the connection's tokens.
The SDK adds db.relate().
Lists the ids of sessions attached on the server.
The SDK exposes connection status through db.status.
Reports connection status as disconnected, connecting, reconnecting or connected; db.subscribe registers event listeners and returns an unsubscribe function.
The SDK adds db.subscribe(event, listener).
The SDK supports sized numbers such as F32.
The query builder adds a fetch() method.
The SDK adds fork_session() among its session and token operations.
The SDK adds health() among its session and token operations.
The SDK supports sized numbers such as I32.
Adds fixed-width numeric types I8, U8, I16, U16, I32, U32, U64, F16 and F32, with range checks and width rounding where applicable.
The SDK supports the Interval type.
Call kill() on a live-query subscription to stop it.
The set operation is available under its JS SDK name on connections, sessions and transactions.
The query builder adds a limit() method.
live() returns a subscription that can be iterated to receive notifications.
Attaches to a live query started by another means, such as a LIVE SELECT sent with query(); it is not restarted after reconnect.
The query builder adds an output() method.
The SDK supports the PlainDate type.
Adds SurrealDB 4.0 value types PlainDate, PlainTime, Timestamp, Interval, BigDecimal and Regex, with conversions and value behavior described in the notes.
The SDK supports the PlainTime type.
WebSocket connections reconnect automatically and restore connection state and live queries; set reconnect=False to disable this.
Configures reconnect attempts, delay, maximum delay, multiplier and jitter.
The SDK adds refresh() among its session and token operations.
The SDK supports the Regex type.
Connections renew their own access token shortly before expiry by default, using a refresh token when supported or applying auth again.
The SDK adds reset() among its session and token operations.
Select builders add fetch, limit, start and version modifiers, compiled into the SurrealQL statement.
The SDK adds sessions() among its session and token operations.
The query builder adds a start() method.
Represents a record id written as SurrealQL for the server to parse, including ids that RecordID.parse refuses; usable wherever a RecordID is accepted.
Adds a start capability setting to allow all HTTP routes except those denied, or to allow only a listed set of routes.
Adds a start capability setting to allow all RPC methods except those denied, or to allow only a listed set of methods.
Adds a start setting for how often a node checks for unfinished index builds left by stopped nodes and resumes them; set to 0 to disable.
Configures how often the TiKV MVCC garbage collector runs; it defaults to 10m and is only used with a TiKV datastore. The start command also accepts tikv-gc-interval.
Sets how far behind the current timestamp the TiKV garbage collection safepoint may sit; it defaults to 10m. The effective SURREAL_RECLAIM_GRACE is never shorter than this value.
Configures how often stale TiKV transaction locks are resolved; it defaults to 60s and is only used with a TiKV datastore. The start command also accepts tikv-lock-cleanup-interval.
Add the embedded extra to use mem://, file:// or surrealkv://.
The query builder adds a timeout() method.
The SDK supports the Timestamp type.
The SDK raises UnexpectedResponseError when a response does not contain a valid SurrealDB value.
Can change only the database or namespace; None preserves the current value and Null clears it.
The query builder adds a version() method.
The query builder adds a where() method.
Behavior and default changes 1
The default log file format changes from none to text.
Fixes and other changes 2
Decimal values are sent in plain notation, and trailing zeros beyond SurrealDB's 28-digit scale are dropped so the server accepts them.
select(fields=[...]) accepts fields named after keywords, such as value.
surrealdb 25 changes
Breaking changes 1
Python 3.9 support is dropped.
New APIs and options 1
Adds support for SurrealDB 3.x features.
Behavior and default changes 2
Error handling has changed.
Adds support for musl Linux.
Fixes and other changes 1
Fixes the WebSocket session transaction ID issue.
surrealdb 113 changes
Breaking changes 2
GeometryPolygon enforces GeoJSON-compliant closed linear rings.
Database method return types are simplified to Value.
New APIs and options 4
Live queries initiated in db.query can now be subscribed to.
Adds support for using a native embedded database.
The client issues text-based queries instead of using the v1 RPC methods.
Initial stable release of the SurrealDB Python client.
Behavior and default changes 2
RecordId can now be serialized and deserialized by pydantic.
Duration.parse() supports parsing compound durations.
Fixes and other changes 5
The package now supports Python 3.9.
Fixes a race condition in concurrent environments.
Fixes encoding of decimal.Decimal values.
Fixes Duration encoding and decoding.
String identifiers in RecordID are escaped to match SurrealDB behaviour.