Questions tagged [flask-restless]

Flask-Restless provides simple generation of ReSTful APIs for database models defined using SQLAlchemy (or Flask-SQLAlchemy)

Flask-Restless provides simple generation of ReSTful APIs for database models defined using SQLAlchemy (or Flask-SQLAlchemy). The generated APIs send and receive messages in JSON format.

116 questions
3
votes
2 answers

create_api_blueprint() got an unexpected keyword argument 'page_size'

I am new to python. I have used Flask-Restless (0.17.0) for a python2.7 app. After creating an API like so: manager = flask_restless.APIManager(app, flask_sqlalchemy_db=db) manager.create_api(Roles, page_size=0, methods=['GET']) It shows the…
3
votes
1 answer

Flask-Restless & Marshmallow: 'dict' object has no attribute '_sa_instance_state'

I'm working on a basic CRUD JSON REST API using Flask-Restless, Flask-SQLAlchemy and Marshmallow. I'm experiencing a problem using this combination of libraries, but only when I enable deserialization using Marshmallow. I've extensively googled the…
Rik
  • 213
  • 3
  • 11
3
votes
0 answers

Issues in flask-restless due to sqlalchemy.db.Boolean

I have just moved from flask-sqlalchemy to just sqlalchemy. And I have started getting below issue. Issue 1 : I have two models class Candidate(db.Model): __tablename__ = 'candidate' id = db.Column(db.Integer, primary_key=True) …
Hussain
  • 5,057
  • 6
  • 45
  • 71
3
votes
2 answers

Flask-Restless Marshmallow serializer

I'm trying to exclude columns in a Flask-Restless API using a custom deserializer with Marshmallow as suggested by the docs: serializers.py class HeatSchema(Schema): id = fields.Integer() heat_index = fields.Integer() updated_at =…
duffn
  • 3,690
  • 8
  • 33
  • 68
3
votes
1 answer

flask-restless validation_exceptions not working for few column in flask-sqlalchemy models

I am using Flask-Restless for creating /api/v1/candidate. There I have used validation_exceptions=[MyValidationError] # ... code snippet from my models.py .... class MyValidationError(Exception): pass def validate_required_field(method): …
Hussain
  • 5,057
  • 6
  • 45
  • 71
3
votes
1 answer

Is there a way to pass params to a Flask-Restless GET_SINGLE preprocessor?

GET_MANY preprocessors accept a built-in search_params dictionary, but GET_SINGLE ones only accept instance_id. A kw** arg is passed to all pre and postprocessors, but I've found that this is just for forwards compatibility, though this is somewhat…
acannon828
  • 528
  • 7
  • 22
3
votes
1 answer

How to enable CORS with Flask-Restless

I have an API for a postgres database created using Flask-Restless and served using Apache. The API works perfectly until I try to use a javascript-based front-end to access the API when I receive multiple " CORS Error Access-Control-Allow-Origin"…
David McLean
  • 191
  • 1
  • 12
3
votes
0 answers

Flask-Restless API "nested" Exclude / Include columns

I have an api to a database with 2 models. The models have a relationship as follows: Every product is owned by one entity. (many-1) Every entity owns 1 or more products. (1-many) These are defined in the models.py file as follows: class…
David McLean
  • 191
  • 1
  • 12
3
votes
0 answers

Flask-Restless not accepting hybrid_property

I have a hybrid property like this @hybrid_property def address(self): return ', '.join([ self.address_street, self.address_city, self.address_state, self.address_zip ]) @address.setter def address(self,…
Patrick Yan
  • 2,338
  • 5
  • 25
  • 33
3
votes
1 answer

Flask RESTless delete multiple primary key

I've a little problem with Flask RESTless, maybe you can help me :) I have some tables in my SQL (and SQLAlchemy) that are results of N..N relation, and their primary Keys are the sum of two columns. For example Table 1 Key / Table 2 Key / Some…
Alby87
  • 171
  • 1
  • 10
3
votes
0 answers

Custom delete logic in flask-restless

Due to the nature of my application I need some of my records to just set an is_deleted flag when being deleted. Is there a way to do this in flask-restless upon receiving an HTTP DELETE?
sssilver
  • 2,549
  • 3
  • 24
  • 34
3
votes
0 answers

How can I include grandchildren with flask-restless?

I have the following entities. When I do api/event/1, I get the invitation included, but not the invitationResponses. If, and how, is this possible to achieve? When I do api/invitation/1 the invitationResponses are included. class Person(db.Model): …
user713821
  • 349
  • 5
  • 14
3
votes
1 answer

Flask-Restless unable to construct query

I recently using Flask-Restless to create API. When I tried to query the API, I got "unable to construct query" error message on the web browser (firefox). Here is the query: http://localhost:5000/api/product?q={ "filters" : [ { "name": "name",…
Kiddo
  • 1,167
  • 1
  • 12
  • 23
2
votes
0 answers

PATCHing resources with nested objects with Flask/SQLAlchemy

I have the following setup: # models class Author(BaseModel): id = Column(Integer, primary_key=True) first_name = Column(String(64)) last_name = Column(String(64)) class Book(db.Model): id = Column(Integer, primary_key=True) …
kip2
  • 6,473
  • 4
  • 55
  • 72
2
votes
1 answer

JSONAPI: Update relationships including attributes

I have a nested object in my SQLAlchemy table, produced with Marshmallow's nested schema feature. For example, an articles object GET response would include an author (a User type) object along with it. I know that the JSONAPI spec already allows…
kip2
  • 6,473
  • 4
  • 55
  • 72