• Start

Languages

/

Python

/

API Reference

/

Values

Table

Table name wrapper for type-safe table references.

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
Syntax
Table(table_name)

Parameter

Type

Description

table_namestr

The name of the table.

table = Table("users")
print(table.table_name)  # "users"
PropertyTypeDescription
table_namestrThe table name string.

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"))
  • Data types — All SDK data types

  • RecordID — Record identifier with table and ID components

Was this page helpful?