marshmallow-code / marshmallow-code/flask-marshmallow

How to integrate with PickleType

Open
#201 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
887
Forks
65
Avg merge
7h 25m
Merged PRs (30d)
3

Description

I want to pass a list to the schema which uses SQLAlchemy's `PickleType` column.
The json file will looks like this:
```
json_data = {uuid: '123456...', coords: [[x1, y1], [x2, y2]]}
```
But looks like `ma.SQLAlchemyAutoSchema` treat `PickleType` column as string so if I do `schema.load(json_data)` it will say `coords` is `not a valid string`.
I use some trick like `str(json_data(coords)` before `schema.load(json_data)` and `eval(json_data(coords)` after. But when I do `schema.dump(model)`, it will still convert `coords` to string. And I have to `eval` it again.
Is there better way to to integrate with PickleType? Or is there any way to skip the validation for specific column.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the reported load and dump behavior through ma.SQLAlchemyAutoSchema with a SQLAlchemy PickleType column and the coords list shown in the issue. The payload names no files or tests; done means establishing whether PickleType values can round-trip without string conversion or eval, or documenting the supported way to skip or customize validation.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, sqlalchemy
Domain
api, databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.