marshmallow-code / marshmallow-code/flask-marshmallow

How do I create a new ORM object with information passed via JSON?

Open
#246 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
887
Forks
65
Avg merge
7h 25m
Merged PRs (30d)
3

Description

I have an ORM class created with SQLAlchemy, example:

```
class Person(Base):
name = Column(String,nullable=False)
birthdate = Column(String,CheckConstraint("birthdate >= '1970-01-01'")
ssn = Column(String,primary_key=True)
```

My Flask app will be in charge of retrieving and inserting ORM objects like so:

```
@app.route("/people//insert",methods=["PUT"])
def insert_person(ssn):
# insert person into database
```

The information to be inserted will be provided within the request, via a JSON string, ex:
```{"name":"Bobby Burger","ssn":"123-45-6789"}```
I already have a schema defined that I won't mention here.

I want to create an ORM object filled with the information provided.
How do I do this?

Contributor guide

Open the contributing guide

Research direction

The issue mentions a Flask route, a SQLAlchemy ORM class, and an existing schema, but names no repository file or test. Start by locating the project’s request-validation and ORM usage documentation; done would be a clear, project-specific example covering JSON input and object creation.

Written by the indexing model from the issue text.

Assessment

Tech stack
flask, python, sqlalchemy
Domain
api, backend, database
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.