Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

License

NotificationsYou must be signed in to change notification settings

sqlc-dev/sqlc-gen-python

Repository files navigation

version:"2"plugins:  -name:pywasm:url:https://downloads.sqlc.dev/plugin/sqlc-gen-python_1.3.0.wasmsha256:fbedae96b5ecae2380a70fb5b925fd4bff58a6cfb1f3140375d098fbab7b3a3csql:  -schema:"schema.sql"queries:"query.sql"engine:postgresqlcodegen:      -out:src/authorsplugin:pyoptions:package:authorsemit_sync_querier:trueemit_async_querier:true

Emit Pydantic Models instead ofdataclasses

Option:emit_pydantic_models

By default,sqlc-gen-python will emitdataclasses for the models. If you prefer to usepydantic models, you can enable this option.

withemit_pydantic_models

frompydanticimportBaseModelclassAuthor(pydantic.BaseModel):id:intname:str

withoutemit_pydantic_models

importdataclasses@dataclasses.dataclass()classAuthor:id:intname:str

Useenum.StrEnum for Enums

Option:emit_str_enum

enum.StrEnum was introduce in Python 3.11.

enum.StrEnum is a subclass ofstr that is also a subclass ofEnum. This allows for the use ofEnum values as strings, compared to strings, or compared to otherenum.StrEnum types.

This is convenient for type checking and validation, as well as for serialization and deserialization.

By default,sqlc-gen-python will emit(str, enum.Enum) for the enum classes. If you prefer to useenum.StrEnum, you can enable this option.

withemit_str_enum

classStatus(enum.StrEnum):"""Venues can be either open or closed"""OPEN="op!en"CLOSED="clo@sed"

withoutemit_str_enum (current behavior)

classStatus(str,enum.Enum):"""Venues can be either open or closed"""OPEN="op!en"CLOSED="clo@sed"

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors4

  •  
  •  
  •  
  •  

Languages


[8]ページ先頭

©2009-2025 Movatter.jp