Questions tagged [flask-marshmallow]
106 questions
0
votes
1 answer
flask-marshmallow-sqlalchemy - "NoneType" object has no attribute '__mapper__'
I am basically trying to create an API using flask, flask-restx, marshmallow and sqlalchemy to retrieve info for a users fleet as well as create/add new vessels to it.
A user can have multiple vessels, a vessel can have multiple trips and a…

GeorgeK
- 31
- 7
0
votes
1 answer
How to change the class attributes of the instance of the SQLAlchemyAutoSchema
I have a flask_sqlalchemy model that I want to serialize its instance and a list of its instances using SQLAlchemyAutoSchema:
class TestModel(Model):
id = Column(Integer, primary_key=True)
test_comments = relationship("TestCommentModel",…

Amin Ba
- 1,603
- 1
- 13
- 38
0
votes
1 answer
How to make model flask marshmallow_sqlalchemy desrialize related object
I have this code:
import sqlalchemy as sa
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import scoped_session, sessionmaker, relationship, backref
engine = sa.create_engine("sqlite:///:memory:")
session =…

Amin Ba
- 1,603
- 1
- 13
- 38
0
votes
1 answer
Marshmallow Random Errors with Nested fields
I get the following exception using Marshmallow nested types, it's like 50/50% that the exception is thrown, so not everytime I start the program.
Traceback (most recent call last):
File…

Jakob Simon-Gaarde
- 675
- 8
- 26
0
votes
1 answer
Flask marshmallow recurses infinitely when dumping a model object
So I'm using Flask-Marshmallows to dump the database models and convert them into Python objects to fit into my web API.
However, for some reason, the program always raises the following error:
Traceback (most recent call at last):
...
File…

Sam Zhang
- 320
- 4
- 17
0
votes
1 answer
Mapping object IDs in sqlalchemy
I have an existing database schema that uses integers for primary keys and need to add a second UUID column to each table. This UUID is what consumers of the service will use when referring to records and the existing integer IDs will remain private…

ddaits
- 11
- 1
0
votes
0 answers
flask-marshmallow sqlalchemy cannot dump objects
I have a very simple implementation of Flask, Flask-Restful, Flask-SqlAlchemy, and Flask-Marshmallow:
I am getting the validation error: {'_schema': ['Invalid input type.']} when trying to dump an object I just created.
init.py
app =…
0
votes
1 answer
How to validate Fields.Raw in Flask Marshmallow
I'm trying to set up a Webservice that accepts Images via POST methods.
I'm using Python Flask as well as Flask-Apispec to create a Swagger documentation. I thus include this Marshmallow Schema to define which parameters are accepted:
class…

Tran Lan Anh Phan
- 11
- 2
0
votes
1 answer
Empty Json using Flask-Marshmallow and SQLAlchemy
I am trying to create a endpoint to return data from two tables indicator and metadata so I created the model below with indicator = db.relationship('Indicator', backref='metadatas') and indicator_id = db.Column(db.Integer,…

Marcelo Gazzola
- 907
- 12
- 28
0
votes
1 answer
accesing model props in flask-marshmallow schema class with SQLAlchemyAutoSchema
I have a simple db model which references itself, to create a hierarchical structure.
Now I want to build a RESTapi, using Flask, Flask-SQLAlchemy and Flask-marshmallow.
For convenience reasons I inheriet my Schema-classes from…

Random Guy
- 17
- 3
0
votes
1 answer
sqlalchemy relationship select from other table instead of insert
I'm having difficulties in relationships. I have users and roles and defined model and schema for them.
the problem is when I try to add a new user with a previously defined role (I have its ID and name)it will try to update/insert the role table by…

imax
- 1
0
votes
1 answer
Marshmallow deserialization [(obj, "str"), (obj, "str"), (obj, "str"), ...]
I'm working with an existing mssql database, where I'm not able to make any changes. Trying to make an API using Flask and Marshmallow. I have some issues deserializing the following query returning all people working on a project.
query = (
…

thp44
- 11
- 3
0
votes
1 answer
Including flask-marshmallow causes failure
I've got flask-marshmallow of 0.13.0 version
I'm able to access SQLAlchemyAutoSchema in the flask app
when i try to run the application, i get the following error
AttributeError: 'Marshmallow' object has no attribute…

user10028658
- 13
- 2
0
votes
0 answers
How to filter flask-marshmallow nested field?
I working on a user's public-facing profile page, where I would like to display the user's profile as well as their "published" recipes. I have the following UserSchema, but this schema displays all recipes including the one that has not been…

Sam Mas
- 1
- 2
0
votes
1 answer
SQLAlchemy Marshmallow returns empty JSON Flask
I am trying to return all user info, but every time I run the request it returns an empty JSON object
My model and schema:
from flask_sqlalchemy import SQLAlchemy
from flask_marshmallow import Marshmallow
db = SQLAlchemy()
ma =…

Christoffer Hennie
- 69
- 1
- 2
- 9