Questions tagged [flask-marshmallow]

106 questions
0
votes
0 answers

Want to use Dict type

I'm new to Flask/Marshmallow/SQLAlchemy and starting to implement a REST API. Here is a minimal example. Ideally it uses "name":"value" pairs without specifying "name" in a schema. Note: My application isn't really about saving phone numbers and…
RobP
  • 45
  • 4
0
votes
1 answer

Not able to get joins in flask Marshmellow and sql alchemy

I want to get the producttype with admin info who added the producttype I am using sqlalchemy with postgresql and marshmallow This is my Model related info related to Admin class Admin(db.Model): id = db.Column(db.Integer, primary_key=True) …
0
votes
0 answers

how to test Marshmallow schema using pytest

I'm working on a flask application and I'm using marshmallow to validate and "cast" values when someone hit an endpoint, everything works as expected but now I need to write some unit tests for the marshmallow schema that I wrote. Some methods have…
juanp_1982
  • 917
  • 2
  • 16
  • 37
0
votes
1 answer

Flask-smorest returning an empty json string

The JSON response of my endpoint returns {} even though I am logging the correct data. from flask_smorest import Blueprint bp = Blueprint("auth", __name__, url_prefix="/api/v1/auth/") @bp.route("/login",…
spitfiredd
  • 2,897
  • 5
  • 32
  • 75
0
votes
0 answers

Include a nested relation to one schema, without modifying the rest of the functions that use it

Basically I need to add a new nested relation to an schema, that I already use in other services, without this implying a change to the rest of the functionalities that use it. Since I work with sqlalchemy, if I include the new relation, new…
abdiel
  • 2,078
  • 16
  • 24
0
votes
0 answers

How to add alias/description to columns in SQLAlchemy models?

I need to add descriptive names to columns that will be used as keys for JSON data. I could not find any example or documentation related to that. from datetime import datetime from . import db class MyTable(db.Model): __tablename__ =…
Ayaz49
  • 325
  • 2
  • 4
  • 18
0
votes
0 answers

Remove lead dictionary value in marshmallow as well as the first attribute

I am using flask-marshmallow to make an API for a front end client that is already made. In order to give the data off correctly, I need to give data as a list of dictionaries, but I can't figure out how to get APIFairy to stop wrapping the entire…
rockets4all
  • 684
  • 3
  • 8
  • 32
0
votes
1 answer

Marshmallow not pulling entries from String attribute when inside a list

I have a table called Type that associates with a table called Language. I have a 1to1 and a 1tomany relatioship for language and translated_languages from Type to Language. When I try to pull the language out of the 1toMany relationship it gives me…
0
votes
0 answers

Pull database entry string from association in Marshmallow

I have a sqlalchemy database association between Type and Language and am trying to get marshmallow to pull a specific column string from Language but it only wants to give me the object of Language converted to a string. Here is my TypeSchema class…
0
votes
1 answer

Nested Marshmallow field does not show data in nested Schema

I have a table type and language. I have a 1 to many relationship called languages from Type to Language. Marshmallow keeps showing there is no data inside a Type entry despite the data showing up in the console. Does anyone have any idea…
rockets4all
  • 684
  • 3
  • 8
  • 32
0
votes
0 answers

In flask_marshmallow Can you declare a schema to return an array of objects

So I have this schema that I want to return a list of objects, not as a field with a list of objects which I successfully can and do return. Just the array. Is it possible?
rubmz
  • 1,947
  • 5
  • 27
  • 49
0
votes
1 answer

Encoding for marshmallow Schema for japanese characters

This is my simple flask-restful api. To get a name which is in Japanese. When I run this I get {"name":"\u5317\u6d77\u9053"} but expected {"name":"北海道"} Below is the code. class Prefecture(Base): id=Column(Integer, primary_key=True) …
user8183395
  • 115
  • 1
  • 14
0
votes
1 answer

Flask sqlalchemy query using marshmallow not returning nested query result

I am trying to invoke below mentioned query and not seeing the department_info field in the json response .If I use name "Department", the department details are returning.Is there any way to use different name for the nested query result? .Please…
0
votes
1 answer

Flask-SQLAlchemy & Flask-Marshmallow Order with items serialization

For a restaurant application I am trying to set up a Schema in SQLAlchemy with orders and orderlines per order. I am using Flask-SQLAlchemy for the model creation and Flask-Marshmallow for the serialization. I would like to retrieve all orders for a…
0
votes
1 answer

One to many query using marshmallow for response not working

I'm trying to make a query and the response as follows: get_data = request.get_json() email = get_data.get('email') result = User.query.join(User_Preference).filter(User.email==email).first() dump_data =…