Dynamically constructing filters in SQLAlchemy

I am looking for a way to dynamically construct filters using SQLAlchemy. That is, given the column, the operator name and the comparing value, construct the corresponding filter. I'll try to...

Configuring Flask-SQLAlchemy to use multiple databases with Flask-Restless

I have a Flask app that uses Flask-SQLAlchemy and I'm trying to configure it to use multiple databases with the Flask-Restless package. According to the docs, configuring your models to use...

Flask app dont start on heroku server

I'm trying to deploy a Flask app with Heroku. It's simple API. Works great local with foreman but I get error (log is below) when starts on heroku. This is my app code (I know it's but looking in...

Why does my JavaScript code receive a "No 'Access-Control-Allow-Origin' header is present on the requested resource" error, while Postman does not?

Mod note: This question is about why XMLHttpRequest/fetch/etc. on the browser are subject to the Same Access Policy restrictions (you get errors mentioning CORB or CORS) while Postman is not....

How to "select distinct" with flask-restless

I'm new to flask-restless, and looking for a way to do a "SELECT DISTINCT" on a table. I've been reading the docs and found "Function evaluation". But I couldn't find how to put a function...

ImportError: No module named flask.ext.restless

I'm trying to make Restful endpoints for a sqlalchemy database. But for some reason it can't find the Flask Restless extension. When I run the file I get this error: Traceback (most recent call...

search_params empty in a PATCH_MANY preprocessor in flask-restless

I have the following HTTP request issued via PUT: http://example.com/api/student?q=%7B%22filters%22:%5B%7B%22name%22:%22id%22,%22op%22:%22%3D%3D%22,%22val%22:1%7D%5D,%22disjunction%22:true%7D In...

How do I seed a flask sql-alchemy database

I am new at python, I just learnt how to create an api using flask restless and flask sql-alchemy. I however would like to seed the database with random values. How do I achieve this? Please help....

Filter for Flask-Restless doesn't filter results

I am trying to use requests to send a filter query to Flask-Restless. The results are not filtered. How do I correctly write a filter? import requests import json q = {'filters': [{'task':...

Flask search query not using filters

I have a working Flask API and now I want to implement search queries. My understanding is that the filter is applied on the client and the Flask API takes care of...

Flask Restful search query

I have migrated my Flask API from Restless to Restful. https://stackoverflow.com/questions/34942329/flask-search-query-not-using-filters Is there a way to perform search queries from client...

flask-restless use pagination or get full response

Sometimes I want to get from a resource the full response and sometimes I want it with pagination. Until now I was only able to use either the one or the other. But isn't there a way to set...

flask-restless dont work with hybrid property in my models

I am create api for our front-end dev and i have problem with objects in my model. I use flask-sqlalchemy and python2.7 manager = flask_restless.APIManager(app, session =...

python flask_restless with sqlalchemy doesn't generate api endpoints and gives "has no attribute extensions" error using blueprints

for my webapp I want to automatically generate a REST API. I read the of flask_restless docs, tried several tutorials and did everything as described: my routes are to be located in module...

Flask-Restless case-insensitive query

How to make case-insensitive search query using Flask-Restless? Example: api/user?q={"filters":[{"name":"lastname","op":"like","val":"%davidson%"}]} I would like the previous code to return...

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...

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...

Limit data in Flask Restless

how can I limit amout of rows/objects returning by calling an endpoint? http://localhost:8111/api/food_order?q={"filters": [{"name":"user_id","op":"==","val":1188},...

flask restless bulk delete using angularjs or javascript, is that possible?

I want to do bulk delete using angularjs http request to flask restless api version 0.17.0. I know that I can do it one by one, using id of record in url. But I would be pleased if this is...

Flask filter by url

I'm using Flask-Restless and Flask-SQLAlchemy on my application. I can't remember when, but I did a example that I'm almost 100% it was with Flask-Restless to filter a query in the url like...

Using axios to GET data from flask-restless API

I'm trying to use axios to get data from an flask-restless API. The following Python request works no problem: import requests import json url = 'http://127.0.0.1:5001/api/cds' headers =...

Handling complex SQL statements with Python and SQLAlchemy

I am building an analytics page backed up with Python(Flask) and Redshift as data source. Data is presented in a start schema, so all I want to do is basic aggregation and filtering in specified...

AJAX POST throws a 415 Unsupported Media Type Error with message 'Request must have "Content-Type:application/vnd.api+json"'

I have an application that on click of a button, it makes an ajax post request to a flask backend(flask restless). As mentioned, I get an error with the message "Request must have...

How to deploy rabbitmq with flask and docker?

I am doing an application with flask for the back part and angular for the front part, with a microservices architecture. For the deploy, I am using docker, and now, the problem, is to...

How to return Flask-SqlAlchemy error details

I'm using Flask 1.0, Flask-SqlAlchemy 2 and Angular 7. When SqlAlchemy throws an error I want to show a tailored error message in the frontend. There is a section in the official Flask...

Can flask-restful return Response object?

When implementing REST API with Flask-Restful, I wanted to return a Flask's Response object, because it is flexible and easy to use. For example: return Response( response=jsonify({ ...

flask- Wrong URL encoding

I am facing very strange issue in Flask and flask-rest-jsonapi spec. If I send below url using postman i am getting very weird behavior :- Not working...

How to create object together with related object in same POST method using Flask-rest-jsonapi / JSON API?

I have a scenario where i would like to create one new parent object with new child object using FLASK-REST-JSON API package . e.g Scenario like to create a new Person with new computer in one...

How to simple secure APIs on App Engine with API key?

I am looking to secure my API endpoints so that only authorized apps can access or write to it. My stack: Flask (API is built on a Flask-Restplus/Flask-Restless equivalent) GCP - App Engine...

flask application - 100% memory and cpu consumption

In my flask application , we are observing very high memory and cpu consumption almost 100% CPU and memory for one of the API call. We are using flask-rest-json api package . In our model we ...