Table
A Table wraps a table name string, providing a type-safe way to reference SurrealDB tables. It can be used anywhere a RecordIdType is accepted.
Import
from surrealdb import Table
Constructor
Syntax
Table(table_name)
| Parameter | Type | Description |
|---|
table_name required | str | The name of the table. |
Examples
table = Table("users")
print(table.table_name)
Properties
| Property | Type | Description |
|---|
table_name | str | The table name string. |
Usage
Table is interchangeable with a plain str in most SDK methods. It is useful when you want to distinguish table references from arbitrary strings at the type level.
from surrealdb import Surreal, Table
db = Surreal("ws://localhost:8000")
db.connect()
db.use("my_ns", "my_db")
db.signin({"username": "root", "password": "root"})
users = db.select(Table("users"))
See Also