Ginodantic
Project description
Generate pydantic schema from gino models
Github: https://github.com/Basalex/ginodantic
- Meta Class Options
as_dataclass: bool -> pydantic dataclass will be used for generated schema
as_list_fields: Tuple[str] -> listed fields will be generated as List[type]
field_methods: bool -> int and float fields will be generated with postfix __ge, and postfix __le,
field_methods_by_name: Dict[str, List[str]] -> use database field names instead of model field names
fields: Tuple[str] -> only listed fields will be used for generated schema
field_methods: Tuple[str] -> excludes listed fields from generated schema
exclude: Tuple[str] -> excludes listed fields from generated schema
list_pk: bool -> Foreign key and primary key will be interpreted as list
required: Tuple[str] -> only listed fields will be defined as required, can be set as empty tuple
use_db_names: bool -> use database field names instead of model field names
Examples of usage:
from ginodantic import BaseModelSchema
class UserSchema(BaseModelSchema):
class Meta:
model: User
required: ()
exclude: ('email', )
use_db_names: False
field_methods_by_name = {'age': ('le', 'ge')}
class UserSchema(BaseModel):
id: Optional[int] = None
username: Optional[str] = None
age__le: Optional[str] = None
age__ge: Optional[str] = None
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file ginodantic-0.1.0b2.tar.gz
.
File metadata
- Download URL: ginodantic-0.1.0b2.tar.gz
- Upload date:
- Size: 5.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.7.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e998e7cdea2c56876e75e6c21ab1621709736b50630af3c5070d50389e06a892 |
|
MD5 | 5ec72666ccf0cf7783466c6dbfc8b17e |
|
BLAKE2b-256 | a5528dd8c682976e846361b9cb6664ec68d00abf1c754385ce5eaceb11104951 |
File details
Details for the file ginodantic-0.1.0b2-py3-none-any.whl
.
File metadata
- Download URL: ginodantic-0.1.0b2-py3-none-any.whl
- Upload date:
- Size: 6.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.7.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 78e8554dcb62ea89308837fe79bff79befa16962c540feb7349738998489175b |
|
MD5 | 86205d1c381329322d76e517268bb5a6 |
|
BLAKE2b-256 | 58fb14bbbf8b4f94be08f1749c4b0d4563a2f64c68b3b65470a2133a4b63052b |