Flask-SQLALchemy is an extension for Flask that provides SQLAlchemy support. It is designed to make database manipulation through SQLAlchemy even easier and simpler. It has the same three clause BSD License as Flask.

learn more… | top users | synonyms

1
vote
0answers
10 views

add data in loop with db.commit() sqlalchemy PYTHON

I need help with Python code copy_groups = Group() groups = Group.query.filter(Group.project_id == curent_project_id) for i in groups: copy_groups.project_id = curent_project.id copy_groups....
0
votes
0answers
14 views

Only two rows are returned after connecting successfully to SQL Server DB with SQLAlchemy

I am using Flask and SQLAlchemy to connect and use an MS SQL Server database following this post: How to build a flask application around an already existing database? I have succeeded in creating ...
-1
votes
2answers
21 views

SQLAlchemy Add A Table To An Already Existing Database

I'm attempting to add a table to an already existing Database in SQLAlchemy. My app.db is already compiled and populated with data. I'm just trying to add a new table to the database titled ...
0
votes
0answers
14 views

Why is Flask-Admin throwing this exception when attempting to edit a model?

The exception is AttributeError: 'StringField' object has no attribute 'wrap_formdata' and it seems to only happen when I go to create or edit either of the following two models from the Flask-Admin ...
1
vote
0answers
23 views

FLask-SQLAlchemy checking for duplicates in database

Hi I am using the python scrape library to create spiders and extract data from websites. In my pipeline I use Flask-SQLAlchemy to configure the spider so that it adds the scraped data to a SQLite ...
1
vote
1answer
25 views

Using SQLAlchemy models in and out of Flask

I'm trying to build SQLAlchemy models that can be used in Flask and in other non-Flask services. I know that in order to use these objects in Flask I can use the Flask-SQLAlchemy module and build the ...
0
votes
1answer
36 views

Flask - SQLAlchemy full text search

I am trying to build a small online plant database, and would like to incorporate a search engine. I am building my application with Flask and I have the application connected to a MySQL database ...
0
votes
1answer
19 views

Flask app-setting up page dependency for LDAP login

I have 2 webpages /login and /index . I could set up dependency for entering /index page once login is authenticated from LDAP using the following view function and it works perfectly ...
1
vote
1answer
17 views

SQLAlchemy filter related subquery

class Poll(db.Model): id = db.Column(db.Integer, primary_key=True) title = db.Column(db.String(255), unique=False) is_deleted = db.Column(db.Boolean, default=False) created_date = db....
0
votes
1answer
18 views

Flask-SQLAlchemy database engine returns table names, but the table keys in metadata are empty

I am connected to a MS SQL Server. The following returns all the table names in the database: app.config.from_object('config') db = SQLAlchemy(app) db.engine.table_names() However, this doesn't: ...
0
votes
0answers
27 views

How to read data from postgresql in python using Flask and SQLAlchemy?

I started creating a flask application as I will be needing to do some visualization of some data that was recently transferred to a local postgresql database. I have a lot of tables (33) which all ...
0
votes
1answer
26 views

Validate login using javascript from a login page by clicking on “Login button”

Suppose I have a javascript for a "Log in" button in a login.html page. The javascript can look like this var attempt = 3; // Variable to count number of attempts. // Below function ...
0
votes
1answer
15 views

Connect to mysql with sqlalchemy and query

I have a MySQL database with stock market quotes. I'm trying to create a python script to connect to the database and query it. Here is my python script... from flask import Flask from ...
0
votes
0answers
6 views

Exception in thread Thread-2: RuntimeError('application not registered on db '

I am running example program form book Flask Web Development. Program can be found at github. This is the init.py file import os, sys from flask import Flask from flask_bootstrap import Bootstrap ...
1
vote
0answers
23 views

Implement pagination without flask-sqlalchemy

I would like to remove the dependence of flask-SQLAlchemy from my application. Although, I rely pretty heavily on the pagination functionality that comes with the library. I would like to move the ...
0
votes
1answer
26 views

Querying with function on Flask-SQLAlchemy model gives BaseQuery object is not callable error

I want to query services between two dates and sum their prices. When I try to use func.sum with Services.query, I get TypeError: BaseQuery object is not callable. How do I query using a function with ...
0
votes
0answers
14 views

flask-sqlalchemy: insert data into many to many relationship

db schema structure:- 1 . dish table 2. category table 3. dish has category table dish has category:- dish_has_category = db.Table('dish_has_category', db.Column('id', db.Integer, primary_key ...
0
votes
1answer
29 views

Performing PostgreSQL match using OR on a JSON field

I have a model that looks like this class Message(db.Model): content = db.Column(JSON) I want to perform a search on that field which contain some JSON fields normally when I something like ...
1
vote
1answer
32 views

Unable to switch from SQLite to Postgres

I have been following everything in this tutorial for Postgres:https://realpython.com/blog/python/flask-by-example-part-2-postgres-sqlalchemy-and-alembic/ And I have been getting the following error....
1
vote
1answer
37 views

cannot drop table because other objects depend on it

I'm trying to develop a postgres database and I'm using SQLAlchemy to map my db. The thing is that I was getting way too many errors about dependencies and started to clean some relations to debug and ...
0
votes
0answers
35 views

SQLAlchemy ORM polymorphic_on from relationship

I want to use polymorphic loading of a class, using a discriminator from a relationship. It's easy enough to do if there was a discriminator column present on the 'Publication' model, but what I'm ...
0
votes
1answer
15 views

What type of Exception should SQLAlchemy model raise when an object is not found in DB?

I have a web-app that uses SQLAlchemy with the Flask framework. Below is My SQLAlchemy model (simplified): class MyModelA(db.Model): a_id = db.Column(UUIDType(binary=False), nullable=False, ...
1
vote
0answers
20 views

Data Model persistence between requests

I'm building an application using Flask and Flask-SQLAlchemy. In the application I use database models written in the SQLAlchemy declarative language, let's say that I have a table called Server. ...
0
votes
0answers
13 views

oauthlib.oauth2.rfc6749.errors.MismatchingStateError [closed]

I have been facing the above mentioned issue in my flask-google auth app,i require some help here[given in ideone,just as a demo][a gist file]see_link
0
votes
1answer
16 views

How to join with SQLAlchemy from a ref attribute

Title is very confused, my bad about that, but i will explain my problem. I have 3 tables: Entity1 Entity2 Entity3 extract code of Entity1 class Entity1(db.Model): ... entity2 = db....
1
vote
1answer
37 views

flask: post data after insert, delete and update in database

I want to post data to a target url after insertion, updation and deletion in a model in flask like rest-hooks in django. for now i have only found signal events of flask-sqlalchemy like below: @...
1
vote
2answers
27 views

Update random row in DB using Flask-Sqlalchemy

I've been trying to update a randomly selected row in my Sqlite database using Flask and the Flask-Sqlalchemy. I have just a few rows in the database with columns called "word", "yes", and "no", where ...
0
votes
0answers
15 views

sqlalchemy.exc.ProgrammingError - Many to many relatioship

I have this many to many relationship in sqlalchemy which I guess is well done (saw some previous posts and examples) but when I run python manage.py db upgrade I get the following error ...
0
votes
1answer
19 views

Flask sqlAlchemy after disable autoflush and autocommit not working

I am using Flask-sqlalchemy, I just configure it for no auto flush and no autocommit like this db = SQLAlchemy(session_options={"autoflush": False, "autocommit": False}) But it only work for first ...
0
votes
0answers
13 views

SQLAlchemy dedicated read-server pooling

I am currently writing a Flask web application that uses Flask-SQLAlchemy to communicate with a Postgres database. I want to have several read-replicas to which all database read queries can be ...
0
votes
2answers
42 views

__init__() got an unexpected keyword argument 'author' for one to many

So, im trying to reference a users post ? and i keep getting this error error Python 2.7.6 (default, Jun 22 2015, 17:58:13) [GCC 4.8.2] on linux2 Type "help", "copyright", "credits" or "license" ...
0
votes
1answer
21 views

How to query these foreign-key relationships in SQLAlchemy?

I have the following 3 SQL Alchemy models class MyModelA(db.Model): a_id = db.Column(db.Integer, nullable=False, primary_key=True) my_field1 = db.Column(db.String(1024), unique=True) class ...
0
votes
1answer
19 views

Union summary statistics with query result in SQLAlchemy?

I have a PostgreSQL table that stores readings from power meters. I use SQLAlchemy and psycopg2 to query the database. Some large sites can have multiple power meters, and I have a query that returns ...
0
votes
1answer
41 views

Flask: Render Template and Populate HTML Table

Let me explain my end goal and then maybe that will paint a picture of what I'm trying to do. Here is what my application needs to do: End user goes to http://www.example.com/ms_bulletins and they ...
0
votes
1answer
15 views

Flask - Search db model by column

I am using built in admin website of flask for searching data from db. So I created db model, and model view in which I specified column_searchable_list. When I enter search text, it will match this ...
0
votes
0answers
20 views

How do you implement Flask-JWT

This question has probably been asked before, but i doubt it relates to a simple demonstation for a flask login. Pretty much, i want to login, and pass a token using Flask JWT and yes i have look at ...
1
vote
1answer
19 views

Flask_SQLAlchemy, MySQL, store Swedish characters å, ä, ö?

I can't sto re Swedish characters in MySQL by using Flask_SQLAlchemy :( I have tried to find a solution for a week now and I really need help as it feels like I have reached a dead end. I think it ...
2
votes
1answer
36 views

Is there a simpler way to restore state between SqlAlchemy integration tests?

Flask example applications Flasky and Flaskr create, drop, and re-seed their entire database between each test. Even if this doesn't make the test suite run slowly, I wonder if there is a way to ...
0
votes
0answers
15 views

SQLAlchemy: query returns wrong data

I have a flask+sqlalchemy app on Google App Engine with 20 instances and threading disabled in app.yaml. I have a background task that fires off ids to a queue which result in individual HTTP ...
0
votes
1answer
54 views

Flask-SQLAlchemy with_for_update() row lock

I have a model called 'User', and 'User' has 'Money'. There a scenario that multiple session can read the model 'User' and update 'money' at the same time. Session 2 should read the 'money' value ...
6
votes
3answers
126 views

SQLAlchemy OperationalError due to Query-invoked autoflush

I have a table in a database which is created and accessed through SQLAlchemy: I add a record to it using Flask-SQLAlchemy like so: ... content = request.form['content'] date = datetime.today() post ...
0
votes
0answers
34 views

Understanding sessions in sqlalchemy

I read through the SQLalchemy manual about sessions, but I seem to miss something. I get the following error Traceback (most recent call last): File "every_5min.py", line 847, in <module> ...
9
votes
1answer
138 views

Bug in SQLAlchemy Rollback after DB Exception?

My SQLAlchemy application (running on top of MariaDB) includes two models MyModelA and MyModelB where the latter is a child-record of the former: class MyModelA(db.Model): a_id = db.Column(db....
0
votes
1answer
21 views

Passing a row ID in a table to a modal in flask (python)

I have an HTML table which displays some data from a database table.Data is displayed by using a loop.Each row has a button that is also generated via a loop. Am using the button to edit data in a row....
0
votes
1answer
30 views

python: flask-sqlalchemy combine filter_by and _in

Following the example in this question I have a little flask view that filters data based on querystring arguments: @app.route('/regs') def regs_data(): #check what data is available #REGS ...
0
votes
1answer
26 views

How to query Model using SQLAlchemy by ID

There are two tables: "User" and "Project" defined as follows: create table user ( id integer primary key autoincrement ); create table project ( id integer primary key autoincrement, user_id ...
1
vote
1answer
40 views

Flask broken pipe when redirecting after AJAX call

I have an JQuery AJAX call: $.getJSON($SCRIPT_ROOT + '/_click_btn?btnId='+$(this).attr("id"), $('form').serialize(), function(data) { // return to send_messages page ...
0
votes
1answer
39 views

How to compute options of dropdown for column filter in Flask Admin?

In Flask Admin, I got a column of String values (I can't change the DB definition). When filtering this column in the index view, the user should be able to select the value from a dropdown. The ...
0
votes
1answer
25 views

Can you copy/move data between columns in a DB migration file?

I have a SqlAlchemy/Flask application. In it, I have an existing model named MyModelA. This is what it looks like: class MyModelA(db.Model): a_id = db.Column(db.Integer, nullable=False, ...
0
votes
0answers
22 views

Session scoping in Flask-SQLAlchemy

A little background on the project. I have a Flask App that is handling user interaction and daemon handling interaction with onboard sensors and GPIO. I'm sharing the model between the two processes ...