Reflex Logo

Intro

Gallery

Hosting

Learn

Components

Recipes

API Reference

Onboarding
Hosting

Api-reference

/

Model

reflex.model.Model

Base class to define a table in the database.

PropDescription
id: int

The primary key for the table.

SignatureDescription
dict(self, **kwargs)Convert the object to a dictionary.
create_all()Create all the tables.
get_db_engine()Get the database engine.
alembic_init(cls)Initialize alembic for the project.
alembic_autogenerate(cls, connection: 'sqlalchemy.engine.Connection', message: 'str | None' = None, write_migration_scripts: 'bool' = True) -> 'bool'Generate migration scripts for alembic-detectable changes.
migrate(cls, autogenerate: 'bool' = False) -> 'bool | None'Execute alembic migrations for all sqlmodel Model classes. If alembic is not installed or has not been initialized for the project, then no action is performed. If there are no revisions currently tracked by alembic, then an initial revision will be created based on sqlmodel metadata. If models in the app have changed in incompatible ways that alembic cannot automatically generate revisions for, the app may not be able to start up until migration scripts have been corrected by hand.
select(cls)Select rows from the table.

Did you find this useful?

HomeGalleryChangelogIntroductionHosting