Skip to content

Instantly share code, notes, and snippets.

@xnuinside
Created April 24, 2022 10:54
Show Gist options
  • Save xnuinside/decb2b726f4f119fb4760b8169fafc85 to your computer and use it in GitHub Desktop.
Save xnuinside/decb2b726f4f119fb4760b8169fafc85 to your computer and use it in GitHub Desktop.
medium_test_code_generation
def test_pydantic_models_generator_basic():
ddl = """
CREATE table user_history (
runid decimal(21) null
) ;
"""
result = create_models(ddl, models_type="pydantic")["code"]
expected = """from typing import Optional
from pydantic import BaseModel
class UserHistory(BaseModel):
runid: Optional[float]
"""
assert result == expected
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment