RecordID
A RecordID represents a unique record identifier in SurrealDB, combining a table name with an ID value. It is the Python equivalent of SurrealDB's record type.
Source: record_id.py
Constructor
| Parameter | Type | Description |
|---|---|---|
table_name | str | The name of the table this record belongs to. |
identifier | Any | The unique identifier for the record within the table. |
Examples
Static Methods
RecordID.parse()
Parses a record ID from its string representation.
| Parameter | Type | Description |
|---|---|---|
record_str | str | A record ID string in table_name:id format. |
Returns: RecordID
Properties
| Property | Type | Description |
|---|---|---|
table_name | str | The table name component of the record ID. |
id | Value | The identifier component of the record ID. |
Methods
__str__()
Returns the string representation in table_name:id format.
__eq__()
Compares two RecordID instances for equality based on both table_name and id.
Pydantic Support
When the pydantic extra is installed (pip install surrealdb[pydantic]), RecordID can be used as a field type in Pydantic models with automatic validation and serialization.
RecordIdType
Methods that accept a record or table reference use the RecordIdType alias, which accepts a plain string, a Table, or a RecordID.
See the Data Types overview for details.
See Also
Data Types — All SDK data types
Table — Table name wrapper
Surreal — Connection and query methods