Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SQLModel support #54

Merged
merged 1 commit into from
Jan 2, 2023
Merged

SQLModel support #54

merged 1 commit into from
Jan 2, 2023

Conversation

bogdandm
Copy link
Owner

@bogdandm bogdandm commented Jan 2, 2023

Add code generator for https://sqlmodel.tiangolo.com/

@bogdandm
Copy link
Owner Author

bogdandm commented Jan 2, 2023

Fixes #49

@bogdandm
Copy link
Owner Author

bogdandm commented Jan 2, 2023

- id: 1
  name: Mario
  secret_name: Foo
  age: 31

- id: 2
  name: Zeus
  secret_name: Bar
r"""
generated by json2python-models v0.2.7 at Mon Jan  2 16:02:11 2023
command: /opt/projects/json2python-models/json_to_models/__main__.py -s flat --max-strings-literals 0 -m Hero temp.yaml -f sqlmodel -i yaml
"""
from sqlmodel import Field, SQLModel
from typing import Optional


# Warn! This generated code does not respect SQLModel Relationship and foreign_key, please add them manually.
class Hero(SQLModel, table=True):
    id: int = Field(..., primary_key=True)
    name: str
    secret_name: str
    age: Optional[int] = None

@coveralls
Copy link

Coverage Status

Coverage: 98.072% (+0.03%) from 98.043% when pulling c7664ef on sqlmodel-support into cdd4413 on master.

@bogdandm bogdandm merged commit 88e196c into master Jan 2, 2023
@bogdandm bogdandm deleted the sqlmodel-support branch January 2, 2023 12:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants