API Reference¶
Database Constants¶
Core Constants¶
FrameWorkType
¶
OrmType
¶
WriterClassType
¶
Bases: Enum
Enum for writer class types.
Source code in src/supabase_pydantic/core/constants.py
Utility Constants¶
AppConfig
¶
Bases: TypedDict
Configuration for the Supabase Pydantic tool.
Source code in src/supabase_pydantic/utils/constants.py
Database Models¶
ColumnInfo
dataclass
¶
Bases: AsDictParent
Column information.
Source code in src/supabase_pydantic/db/models.py
has_default
property
¶
Check if the column has a default value.
is_generated
property
¶
Check if the column is auto-generated (identity or serial).
__str__()
¶
is_user_defined_type()
¶
nullable()
¶
orm_datatype(orm_type=OrmType.PYDANTIC)
¶
Get the datatype for a column.
Source code in src/supabase_pydantic/db/models.py
orm_imports(orm_type=OrmType.PYDANTIC)
¶
Get the unique import statements for a column.
Source code in src/supabase_pydantic/db/models.py
ConstraintInfo
dataclass
¶
Bases: AsDictParent
Source code in src/supabase_pydantic/db/models.py
__str__()
¶
TableInfo
dataclass
¶
Bases: AsDictParent
Source code in src/supabase_pydantic/db/models.py
167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 |
|
__str__()
¶
add_column(column)
¶
add_constraint(constraint)
¶
add_foreign_key(fk)
¶
aliasing_in_columns()
¶
get_primary_columns(sort_results=False)
¶
get_secondary_columns(sort_results=False)
¶
has_unique_constraint()
¶
primary_is_composite()
¶
primary_key()
¶
Get the primary key for a table.
Source code in src/supabase_pydantic/db/models.py
sort_and_separate_columns(separate_nullable=False, separate_primary_key=False)
¶
Sort and combine columns based on is_nullable attribute.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
separate_nullable
|
bool
|
Whether to separate nullable and non-nullable columns. |
False
|
separate_primary_key
|
bool
|
Whether to separate primary key and secondary columns. |
False
|
Returns:
Type | Description |
---|---|
SortedColumns
|
A dictionary with keys, nullable, non_nullable, and remaining as keys |
SortedColumns
|
and lists of ColumnInfo objects as values. |
Source code in src/supabase_pydantic/db/models.py
table_dependencies()
¶
Core Models¶
EnumInfo
dataclass
¶
Source code in src/supabase_pydantic/core/models.py
python_class_name()
¶
Converts DB enum name to PascalCase for Python class, prefixed by schema.
e.g., 'order_status' in 'public' -> 'PublicOrderStatusEnum'
Source code in src/supabase_pydantic/core/models.py
python_member_name(value)
¶
Converts enum value to a valid Python identifier.
e.g., 'pending_new' -> 'pending_new'
Writers¶
Serialization¶
AsDictParent
dataclass
¶
Source code in src/supabase_pydantic/utils/serialization.py
CustomJsonEncoder
¶
Bases: JSONEncoder
Custom JSON encoder for encoding decimal and datetime.
Source code in src/supabase_pydantic/utils/serialization.py
default(o)
¶
Encode decimal and datetime objects.