Questions tagged [marshmallow-sqlalchemy]
54 questions
0
votes
1 answer
Nested fields with mashmallow_sqlalchemy and flask_marshmallow
I am trying to get a nested serialized output, but all I get is the 'many' side of the many-to-one's table's primary key.
Expected output:
[{'part_numbers':
{'part_number': '23103048', 'description': 'blue product'},
…

LarsaSolidor
- 135
- 2
- 12
0
votes
1 answer
Use order output parameter and specify serialization key with marshmallow-sqlalchemy
I'm using marshmallow 3.4.0 and marshmallow-sqlalchemy 0.22.2
I have this SQLAlchemy model and Marshmallow schema
class Zone(Base):
zone_id = Column(Integer, primary_key=True)
name = Column(String(65))
location_id = Column(Integer,…

Francois
- 166
- 1
- 10
0
votes
1 answer
Posting Nested models SQLAlchemy-Marshmallow
I am trying to wrap my head around SQLAlchemy in combination with Marshmallow. I had a Flask API that contains some Assets and Trading Pairs. I want bidirectional One-to-Many relationships between these models. I have the following code:
class…

BramGrooteman
- 1
- 4
0
votes
1 answer
How can I create a Schema in Marshmallow to reverse-nest queried data?
Sorry if this sounds silly, but i'm trying to get all the books for an author. This is what I have:
class Author(db.Model):
__tablename__='author'
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String)
class…

Pstr
- 777
- 1
- 8
- 17
0
votes
1 answer
Avoid several json.loads from MySQL database while Reading
I'm a newbie to programming in python and would like to set up a MySQL database with flask on pythonanywhere.com. I execute the Reading/Writing process from/to the database using Marshmallow-sqlalchemy. Right now, I'm a bit staggered about the…

Mxrsxpxxl
- 1
- 1
0
votes
1 answer
What is replacement of fields.Method in flask-marshmallow?
I am writing a REST API using python-flask.
I want to do some process on fetched fields before serializing them. So I guess the best solution is fields.Method but it seems fields.Method is removed from marshmallow since 3.0 version. What is the…

hd.
- 17,596
- 46
- 115
- 165
-1
votes
1 answer
'TypeError: Object of type is not JSON serializable' in Flask Marshmallow SqlAlchemy with Pluck?
I have two related object models that I am attempting to return through a marshmallow schema by using pluck. The primary model is a Product with a related field "technology_pillar" joined on a foreign key that should always return. In the schema…

Justin Kelley
- 1
- 2
-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