Skip to content

Instantly share code, notes, and snippets.

View secondarykey's full-sized avatar

secondarykey secondarykey

View GitHub Profile
@joshbuchea
joshbuchea / semantic-commit-messages.md
Last active July 5, 2024 19:12
Semantic Commit Messages

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@dogrunjp
dogrunjp / Flask_SQLAlchemy_marshmaloow.py
Last active September 24, 2017 05:32
PythonなアプリからJSONを出力する方法はいろいろあると思いますが、SQLAlchemy利用が前提だとJSONシリアライズの前にオブジェクトの変換を自前で作るケースが多いようです。"marshmallow"はデータ型変換ライブラリでORMとの併用が可能です。Flask+SQLAlchemyなアプリからJSONを返すときなどこのライブラリを使うと少し実装が楽になるような……気もします。
##前提としてSQLAlchemyで以下のようなモデルがあるとします。
class Dog(Base):
Birth = Column(Date)
Name = Column(Text)
Breed = Column(Text)
def __init__(self, Birth, Name, Breed):
self.Birth = Birth
self.Name = Name
self.Breed = Breed