omymodels

O!My Models (omymodels) is a library to generate Pydantic, Dataclasses, GinoORM Models, SqlAlchemy ORM, SqlAlchemy Core Table, Models from SQL DDL. And convert one models to another.

MIT License

Downloads
4.6K
Stars
155
Committers
8
omymodels - Added support for current_timestamp Latest Release

Published by xnuinside about 2 years ago

v0.12.1

Improvements

  1. current_timestamp function processed now same was as "now()" function from ddl
omymodels - Fixes & possibility to disable snake_case convert

Published by xnuinside about 2 years ago

v0.12.0

Fixes

  1. Now named arguments always went after positional. Fix for https://github.com/xnuinside/omymodels/issues/35

New feature:

  1. Availability to disable auto-name convertion - https://github.com/xnuinside/omymodels/issues/36.
    Now, if you want to keep names 1-to-1 as in your DDL file, you can set argument no_auto_snake_case=True and O!MyModels will do nothing with the table or column names.
omymodels - 0.11.1 - small release with improvements

Published by xnuinside over 2 years ago

v0.11.1

Improvements:

  1. added bytes type to pydantic - https://github.com/xnuinside/omymodels/pull/31
  2. parser version updated to the latest
omymodels - v0.11.0 MSSQL fixes

Published by xnuinside almost 3 years ago

v0.11.0

Fixes:

  1. MSSQL column & tables names in [] now is parsed validly - https://github.com/xnuinside/omymodels/issues/28
  2. names like 'users_WorkSchedule' now converted correctly to PascalCase like UsersWorkSchedule
omymodels - v0.10.0 - Converter improvements, Enums moved to separate model

Published by xnuinside about 3 years ago

Improvements:

  1. Meta models moved to separate package - https://github.com/xnuinside/table-meta
  2. common module renamed to from_ddl, but anyway please use public API as imports from main module:

from omymodels import create_models or from omymodels import convert_models

Fixes:

  1. Fixed bunch of bugs in converter, but it stil in 'beta'.
  2. Previously you can generate models if was any tables in ddl. Now you can also generate Enum models if in ddl you have only CREATE TYPE statements.
  3. String enums now in any models types will be inherit from (str, Enum)

Features:

  1. Added converter feature to convert one model type to another (excluding SQLAlchemy Core (Tables)).
    Now with more tests for supported models, but still in Beta with bucnh of issues.
omymodels - v0.9.0 - Beta version of Models converter

Published by xnuinside about 3 years ago

Features:

  1. Added beta models converter from one type of models to another.
    To use models convertor:
from omymodels import convert_models


models_from = """

class MaterialType(str, Enum):

    article = "article"
    video = "video"


@dataclass
class Material:

    id: int
    title: str
    description: str
    link: str
    type: MaterialType
    additional_properties: Union[dict, list]
    created_at: datetime.datetime
    updated_at: datetime.datetime

"""

result = convert_models(models_from, models_type="gino")
print(result)

where models_type - type of models that you want to get as a result

  1. Now if O!MyModels does not know how to convert type - he just leave it as is.

Fixes:

  1. In Dataclass & Pydantic generators now Decimals & Floats converted to float (previously was int).
omymodels - v0.8.3 - Fixes for dataclasses & refactoring for future code converter feature

Published by xnuinside over 3 years ago

v0.8.3

  1. Added fundamental concept of TableMetaModel - class that unifies metadata parsed from different classes/ORM models types/DDLs to one standard to allow easy way convert one models to another
    in next releases it will be used for converter from one type of models to another.
  2. Fixed issue: https://github.com/xnuinside/omymodels/issues/18 "NOW() not recognized as now()"
  3. Fixed issue: https://github.com/xnuinside/omymodels/issues/19 "Default value of now() always returns same time, use field for dataclass"