Skip to content

Reflection

Reflection reads live database metadata through the native runtime and exposes a small async inspector API.

ormdantic.reflection.Inspector

Inspector(database)

Small runtime inspector backed by the Rust runtime.

Source code in ormdantic/reflection.py
def __init__(self, database: Any) -> None:
    self._database = database

table_names async

table_names()

Return table names for supported dialects.

Source code in ormdantic/reflection.py
async def table_names(self) -> list[str]:
    """Return table names for supported dialects."""
    return list(self._database._ensure_runtime().table_names())

columns async

columns(table)

Return column metadata for a table.

Source code in ormdantic/reflection.py
async def columns(self, table: str) -> list[dict[str, Any]]:
    """Return column metadata for a table."""
    return list(self._database._ensure_runtime().columns(table))

indexes async

indexes(table)

Return index metadata for a table.

Source code in ormdantic/reflection.py
async def indexes(self, table: str) -> list[dict[str, Any]]:
    """Return index metadata for a table."""
    return list(self._database._ensure_runtime().indexes(table))

foreign_keys async

foreign_keys(table)

Return foreign key metadata for a table.

Source code in ormdantic/reflection.py
async def foreign_keys(self, table: str) -> list[dict[str, Any]]:
    """Return foreign key metadata for a table."""
    return list(self._database._ensure_runtime().foreign_keys(table))

For migration-grade reflection, use db.migrations.live_snapshot().