Using `Related(column=...)` with non-standard column types

オープン
#478 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
35/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
python, sqlalchemy
領域
database

調査の方向性

まず、issue で説明されているカスタム EnumField を使い、SQLAlchemy's EnumType、category という名前のモデル列、および Related(column='category') でエラーを再現します。Related がデータベース値をどのようにシリアライズするかを追跡します; 要求されたフィールドが Enum JSON エラーなしでシリアライズとデシリアライズを制御できれば完了です。

索引モデルが issue の本文から書いたものです。

説明

I have a model which uses EnumType from sqlalchemy called category.
When I try to dump some information in my schema with Related(column='category')
It throws an error that Enum cannot be serialized to JSON

Is there a way for me to let ma-sqla know that this field should be dumped using a field I have created called EnumField which handles the serialization and deserialization logic ?

I guess Related is currently assuming it can take the value from the DB directly. So, maybe we need a Related(column='category', column_field=EnumField) or something which is used to serialize/deserialize the value

主要言語
Python
スター
580
フォーク
105
平均マージ
9時間 8分
マージ済み PR(30日)
3

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

marshmallow-code/marshmallow-sqlalchemy のほかの issue

marshmallow-code/marshmallow-sqlalchemy の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。