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)
ParameterTypeDescription
table_name strThe name of the table.

Examples

table = Table("users")
print(table.table_name) # "users"

Properties

PropertyTypeDescription
table_namestrThe 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

  • Data Types — All SDK data types

  • RecordID — Record identifier with table and ID components