API Reference¶
Constants¶
DatabaseConnectionType
¶
FrameWorkType
¶
OrmType
¶
WriterClassType
¶
WriterConfig
dataclass
¶
Source code in supabase_pydantic/util/constants.py
Dataclasses¶
ColumnInfo
dataclass
¶
Bases: AsDictParent
Source code in supabase_pydantic/util/dataclasses.py
is_user_defined_type()
¶
nullable()
¶
orm_datatype(orm_type=OrmType.PYDANTIC)
¶
Get the datatype for a column.
Source code in supabase_pydantic/util/dataclasses.py
orm_imports(orm_type=OrmType.PYDANTIC)
¶
Get the unique import statements for a column.
Source code in supabase_pydantic/util/dataclasses.py
ConstraintInfo
dataclass
¶
Bases: AsDictParent
Source code in supabase_pydantic/util/dataclasses.py
TableInfo
dataclass
¶
Bases: AsDictParent
Source code in supabase_pydantic/util/dataclasses.py
144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 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 |
|
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.
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 supabase_pydantic/util/dataclasses.py
table_dependencies()
¶
Abstract Writer Classes¶
AbstractClassWriter
¶
Bases: ABC
Source code in supabase_pydantic/util/writers/abstract_classes.py
column_section(comment_title, columns)
staticmethod
¶
Method to generate a section of columns.
write_class(add_fk=False)
¶
Method to write the complete class definition.
write_columns(add_fk=False)
¶
Method to generate column definitions for the class.
Source code in supabase_pydantic/util/writers/abstract_classes.py
write_definition()
¶
Method to generate the class definition for the class.
write_docs()
abstractmethod
¶
write_foreign_columns(use_base=False)
abstractmethod
¶
Method to generate foreign column definitions for the class.
write_metaclass(metaclasses=None)
abstractmethod
¶
Method to generate the metaclasses for the class.
write_name()
abstractmethod
¶
write_operational_class()
abstractmethod
¶
write_primary_columns()
abstractmethod
¶
Method to generate column definitions for the class.
write_primary_keys()
abstractmethod
¶
Method to generate primary key definitions for the class.
AbstractFileWriter
¶
Bases: ABC
Source code in supabase_pydantic/util/writers/abstract_classes.py
join(strings)
¶
save(overwrite=False)
¶
Method to save the file.
Source code in supabase_pydantic/util/writers/abstract_classes.py
write()
¶
Method to write the complete file.
Source code in supabase_pydantic/util/writers/abstract_classes.py
write_base_classes()
abstractmethod
¶
Method to generate class definitions for the file.
write_custom_classes()
abstractmethod
¶
Method to generate custom class definitions for the file.
write_imports()
abstractmethod
¶
write_operational_classes()
abstractmethod
¶
Method to generate operational class definitions for the file.
Marshaling Logic¶
add_constraints_to_table_details(tables, constraints)
¶
Add constraints to the table details.
Source code in supabase_pydantic/util/marshalers.py
add_foreign_key_info_to_table_details(tables, fk_details)
¶
Add foreign key information to the table details.
Source code in supabase_pydantic/util/marshalers.py
add_relationships_to_table_details(tables, fk_details)
¶
Add relationships to the table details.
Source code in supabase_pydantic/util/marshalers.py
add_user_defined_types_to_tables(tables, enum_types, enum_type_mapping)
¶
Get user defined types and add them to ColumnInfo.
Source code in supabase_pydantic/util/marshalers.py
analyze_bridge_tables(tables)
¶
analyze_table_relationships(tables)
¶
Analyze table relationships.
Source code in supabase_pydantic/util/marshalers.py
column_name_is_reserved(column_name)
¶
Check if the column name is a reserved keyword or built-in name or starts with model_.
Source code in supabase_pydantic/util/marshalers.py
column_name_reserved_exceptions(column_name)
¶
Check for select exceptions to the reserved column name check.
construct_table_info(column_details, fk_details, constraints, enum_types, enum_type_mapping)
¶
Construct TableInfo objects from column and foreign key details.
Source code in supabase_pydantic/util/marshalers.py
get_alias(column_name)
¶
Provide the original column name as an alias for Pydantic.
Source code in supabase_pydantic/util/marshalers.py
get_enum_types(enum_types)
¶
Get enum types.
Source code in supabase_pydantic/util/marshalers.py
get_table_details_from_columns(column_details)
¶
Get the table details from the column details.
Source code in supabase_pydantic/util/marshalers.py
get_unique_columns_from_constraints(constraint)
¶
Get unique columns from constraints.
Source code in supabase_pydantic/util/marshalers.py
get_user_type_mappings(enum_type_mapping)
¶
Get user type mappings.
Source code in supabase_pydantic/util/marshalers.py
is_bridge_table(table)
¶
Check if the table is a bridge table.
Source code in supabase_pydantic/util/marshalers.py
parse_constraint_definition_for_fk(constraint_definition)
¶
Parse the foreign key definition from the constraint.
Source code in supabase_pydantic/util/marshalers.py
standardize_column_name(column_name)
¶
Check if the column name is a reserved keyword or built-in name and replace it if necessary.
Source code in supabase_pydantic/util/marshalers.py
update_columns_with_constraints(tables)
¶
Update columns with constraints.