Questions tagged [flask-marshmallow]
106 questions
1
vote
1 answer
General REST API: Insert Parent and Child at one request
I'm building a REST API with more or less complex resources.
So let's say, i have the following Database Structure behind the Scenes.
ParentBase: id|name
ChildBase: id|name|parentId
So, obviously column "parentId" of childBase is a foreignKey to…

Jakob
- 113
- 1
- 10
1
vote
0 answers
Marshmallow nested relationship beyond one level deep
I have the following schemas in marshmallow that rely on models built with sqlalchemy. I am able to show an API response with multiple subscription prices that come from a many-to-many relationship off of the Journal model that is called…

Casey
- 2,611
- 6
- 34
- 60
1
vote
1 answer
Flask marshmallow remove key from nested dict
I have the following schema:
class PublisherSchema(ma.SQLAlchemyAutoSchema):
class Meta:
fields = ('name',)
model = Publisher
class JournalSchema(ma.SQLAlchemyAutoSchema):
class Meta:
fields = ('title',…

Casey
- 2,611
- 6
- 34
- 60
1
vote
0 answers
Python Marshmallow AttributeError: 'list' object has no attribute 'get'
I have this schema
from marshmallow import validate, ValidationError
from marshmallow_jsonapi import fields
from marshmallow_jsonapi.flask import Relationship, Schema
class UserSchema(Schema):
first_name = fields.Str(required=True])
…

Shafin M
- 91
- 2
- 11
1
vote
1 answer
Flask Sqlalchemy association table overwrites data
I have created an api where the user will send me the user_id and branch_id/branches_id and my api will insert records in my association table.
e.g
My post request is
{
"branches" : [2,3,4],
"user_id" : 1
}
Result is
# user_id…

Gau Rav
- 357
- 3
- 13
1
vote
0 answers
How can I serialize blob data using python restapi?
Basically I have created the table as below:
class ImageData(db.Model):
id = db.Column(db.Integer, primary_key = True)
uname = db.Column(db.VARCHAR(20), nullable = True, unique=True)
fname = db.Column(db.VARCHAR(20), nullable = True)
lname =…

Dibyajyoti Parida
- 31
- 2
1
vote
1 answer
Combine information from two tables automatically
I have two tables Materials and MaterialSubFamilies which are defined like this:
class MaterialSubFamilies(db.Model):
sub_family = db.Column(db.String(64), index=True)
materials = db.relationship('Materials', backref='msub_family',…

Boris
- 105
- 1
- 5
1
vote
2 answers
SQLAlchemy & SQLAlchemySchema GET return jsonified data is empty dictionary
This is my Model:
class Todo(db.Model):
__tablename__ = "todos"
id = db.Column(db.Integer, primary_key=True)
description = db.Column(db.String(), nullable=False)
class TodoSchema(ma.SQLAlchemySchema):
class Meta:
model =…

Data Mastery
- 1,555
- 4
- 18
- 60
1
vote
1 answer
raise ValueError("Deserialization requires a session")
indeed a very weird error I am dealing with. Weird because the same project is working fine when I am running it on localhost in pyCharm, however, when I uploaded all the files to EC2 server. I got the following error.
The project is running fine so…

GKV
- 864
- 1
- 12
- 25
1
vote
1 answer
Flask, marshmallow - problem with nested field
I have 2 tables with "one-to-one" relationship.
When I get data from one table I want to include one field from the related table but without "dot notation".
What works:
class UserEntitySchema(db_schema.Schema):
class Meta:
fields =…

mimic
- 4,897
- 7
- 54
- 93
1
vote
1 answer
Marshmallow ModelSchema to Mapping Class Inheritance SqlAlchemy
i am with this problem, i using ModelSchema to validade my API input and this give me a Database Model, it works fine, but if i use a Mapping Class Inheritance(Single Table type) the ModelSchema give me only the parent without the children…

Caio Filus
- 705
- 3
- 17
1
vote
0 answers
flask marshmallow hyperlinkrelated field query params
I am using the flask-marshmallow package's HyperlinkRelatedField and wanted to know if it was possible to add query-string parameters dynamically with one of the provided fields (either a field from flask marshmallow or marshmallow like…

Verbal_Kint
- 1,366
- 3
- 19
- 35
0
votes
1 answer
Marshmallow: Schema.load() should not validate the data again if it is previously validated
In my web application's backend code (written in Python using Flask and Marshmallow), I first call Marshmallow's Schema.validate() and if I get a dictionary of errors, I send the errors to the Frontend.
If there are no validation errors, I proceed…

AllSolutions
- 1,176
- 5
- 19
- 40
0
votes
0 answers
I'm getting 404 error when I run my flask API
I'm trying to send a GET request and a POST requests. Both http requests gave me a 404 error code. I do have my tables already up on PGAdmin and my database (I had to manaully create the tables because, the flask migrations weren't working. Chatgpt…

Babit56
- 1
- 1
0
votes
1 answer
Python Marshmallow validate schema for list of objects?
I am trying to call an API, and parse the results and then return the parsed results.
Here is my schema in marshmallow:
from marshmallow import Schema, fields, post_load
import json
class MyResponseDataSchema(Schema):
path =…
user13841758