Questions tagged [marshmallow]

Marshmallow is an ORM/ODM/framework-agnostic library for converting complex datatypes, such as objects, to and from native Python datatypes. (For Questions about Android Marshmallow use the tag [android-6.0-marshmallow].)

Marshmallow is an ORM/ODM/framework-agnostic library for converting complex datatypes, such as objects, to and from native Python datatypes. See https://marshmallow.readthedocs.io/en/latest/index.html

589 questions
0
votes
0 answers

RESTful Localization (Flask)

I have a flask app with database. I need to localize some types of entities there. The problem is, i am using Flask-Marshmallow for parsing/serializing my database objects. And there is an endpoint, that grabs the root object (User) and all it…
Artem Zaytsev
  • 1,621
  • 20
  • 19
0
votes
1 answer

When importing Flask-Marshmallow Unexpected keyword argument error

I have a small project running Flask-Admin which I have dockerised. All of a sudden I can't get the project to build. I've gone through previous commits and can't work out what the issue is. It appears to be the importing of flask-marshmallow but I…
user7692855
  • 1,582
  • 5
  • 19
  • 39
0
votes
1 answer

How i can update a value of object from api response

I am completely new to the Python world, but I am trying to learn this beautiful language. But I need your help. I have an API, and I want it when a user wants to change the value of any data about his product, and it is updated with the new…
user3693057
0
votes
1 answer

Flask SQLAlchemy query from heirarchy

I'm using Flask and SQLAlchemy with marshmallow, and trying to work my head around something. If I have several models (tables) that work using Foreign Keys in a heirarchy, how can I properly query a result from the furthest child? Eg: class…
CareFree
  • 301
  • 1
  • 11
0
votes
1 answer

Working with reference fields in marshmallow-mongoengine

How does one dereference ReferenceFields in marshmallow_mongoengine? For example, dump_data = author_schema.dump(author).data results in '5578726b7a58012298a5a7e2' instead of the more useful response {title='Fight Club', author=author}. from…
spitz
  • 658
  • 1
  • 8
  • 19
0
votes
1 answer

Accessing marshmallow decorators when using flask-marshmallow

I'm using flask-restful, flask-sqlalchemy and flask-marshmallow to build an API service. I define the following - ma = Marshmallow(app) However, trying to access the @validates decorator using ma throws an error. @ma.validates('field1') What am I…
0
votes
2 answers

How to deserialize a bjson structure to an marshmallow schema

I'm trying to convert bjson structure to a schema in marshmallow library. Below is the marshmallow schema: class GeneSchema(Schema): """description of class""" id_entrez = fields.Integer(required = True, error_messages={'required': "The…
Kadu
  • 343
  • 7
  • 17
0
votes
1 answer

Serialization optimization using Marshmallow, other solutions

This seems like it should be straightforward, but alas: I have the following SQLAlchemy query object: all = db.session.query(label('sid', distinct(Clinical.patient_sid))).all() With the desired to serialize the output like [{'sid': 1}, {'sid':…
horcle_buzz
  • 2,101
  • 3
  • 30
  • 59
0
votes
1 answer

Marshmallow: How to handle undeclared fields?

I am trying to validate a dict which contains stringified integers as keys. These ints are arbitrary numerical IDs, and out of my control. How could I declare this in a schema? Maybe there's a way to declare a default schema which I could use as a…
mseery
  • 1,404
  • 2
  • 16
  • 26
0
votes
1 answer

Accessing deserialized data from sibling fields in Python Marshmallow?

I have the following Python class and Marshmallow schema definitions: from marshmallow import Schema, fields, post_load class Author: def __init__(self, id, name): self.id = id self.name = name class Book: def…
mairas
  • 13
  • 5
0
votes
1 answer

Difference on marshmallow between ModelSerializer(model) and ModelSerializer().dump(model)

I'm using marshmallow to serialize my objects to JSON and just realized that the output in ModelSerializer(model).data is equal to ModelSerializer().dump(model).data Is there any difference between them?
gbrennon
  • 899
  • 2
  • 11
  • 30
-1
votes
1 answer

I'm getting raise AttributeError(key) error in Flask

In flask, I'm using marshmallow_sqlalchemy package to serialize and de-serialize model data. I have two models, Account and Address. I have Account foreign key to Address model. My model details are listed below. models.py class Account(db.Model): …
Sins97
  • 155
  • 1
  • 7
-1
votes
1 answer

Marshmallow Invalid input type on nesting

I wrote a nested schema. but whenever i pass the json from postman it shows invalid input type. here is the code below: class ChalanProductsSchema(Schema): product_id = fields.Str(required=True) class ChalanDetailsSchema(Schema): chalan_id…
MNIP
  • 1
  • 1
-1
votes
1 answer

How to Serialize SQL data after a Join using Marshmallow? (flask extension)

I have 2 tables in SQL: class Zoo(db.Model): id = db.Column(db.Integer, primary_key=True) nome = db.Column(db.String(80), unique=True, nullable=False) idade = db.Column(db.Integer, unique=False, nullable=False) peso =…
-1
votes
1 answer

Flask object type X is not JSON serializable

I am using Flask, SQLAlchemy, Marshmallow etc.... This Flask method saves the objects to the database fine, however it errors on the return statement. This is the parent class: class Weather(db.Model): """Weather definition for SQLAlchemy""" …
ABpositive
  • 291
  • 1
  • 18
1 2 3
39
40