an extension for Flask that provides SQLAlchemy support.
0
votes
0answers
2 views
sqlaclemy unique relationship and how to associate foriegnkey table relationship automatically
I have 2 questions?
1. why doesn't unique=True keep me from having duplicates?
I can add the same value over and over to my hearts shagrin
>>>x=models.Syntax(filename='same')
...
0
votes
1answer
9 views
Why an UnmappedInstanceError while populating a database using Flask-SQLAlchemy?
I'm new to SQLAlchemy and am using Flask-SQLAlchemy for my current project. I'm getting an error that has me stumped:
sqlalchemy.orm.exc.UnmappedInstanceError: Class ...
0
votes
1answer
8 views
using Flask-Migrate together with Flask-Security
I'm trying to get a basic Flask-Security app working with Flask-Migrate. I have two main py files: app.py and db_migrate.py
app.py:
from flask import Flask, render_template, request, session
from ...
0
votes
1answer
28 views
Flask and SQLAlchemy db.session.commit not working
Please please any one help.. I have been trying this for almost two hours now, but it won't work..
The problem is, when I add a test user to the User table, it adds fine and it is fine even when i ...
0
votes
1answer
23 views
How do you delete just one row in sql-alchemy without deleting any of its relationships
I'm having problems with dependancy rules. For the life of me I can't figure out how to delete just one row without deleting its relationships.
Tables:
User
-id
-name
Article
-id
-title
...
0
votes
1answer
16 views
How can insert a new object in one table after updating another table in flask-sqlalchemy
I am using Flask-Sqlalchemy orm in my project.
I have to insert a new object in one table, whenever there is an update on another table.So, I chose models_committed signal.But, the object is not ...
0
votes
1answer
19 views
SQLAlchemy: Populate instance attributes from Database query
I'm using SQLAlchemy with the below User model to track users on my site. I'm trying to get the __init__ method to populate all of the fields in the class instance once it's passed a valid user id, ...
0
votes
1answer
14 views
Receiving “No Such Table” error while trying to access existing MySQL database using Flask and SQLAlchemy
myapp.py
#!flask/bin/python
from flask import Flask, request, jsonify
from flask.ext.sqlalchemy import SQLAlchemy
app = Flask(__name__)
db = SQLAlchemy(app)
app.config['SQLAlchemy_DATABASE_URI'] = ...
1
vote
1answer
22 views
Bad request for POST with relationship using flask-restless
I'm using flask-restless and getting a Bad Request (400) error on my first POST (from Postman). If I keep on making the same request, it keeps on erroring. But if I remove the field that ...
1
vote
1answer
46 views
inserting variables and looping over a python class call
I'm using flask-sqlalchemy and flask-wtf. Basically I want to take the string produced by my "row.form_field" query and place it into my wtf form class call. Any ideas on how I can pull this off?
...
0
votes
0answers
14 views
Convert this sql statement to sqlalchemy correctly, is the sql optimal?
I have models as such:
class EmployeeTeam(db.Model):
__tablename__ = 'teams'
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(140), nullable=False)
department = ...
0
votes
0answers
12 views
SQLAlchemy Object already attached to session
I'm trying to get a server for an app working, but I'm getting an error upon login:
[!] Object '<User at 0x7f12bc185a90>' is already attached to session '2' (this is '3')
It seems the session ...
0
votes
1answer
18 views
error: no such table UNABLE TO CREATE DB
i am trying to run a database and make entries into it using the following code to run the database. even though i make proper entries, i still get an error "no such table: user"
from flask import ...
1
vote
1answer
18 views
sqlalchemy query duration logging
My apologies if this has already been asked, but I couldn't find exactly what I was looking for.
I'm looking for the best way to log the duration of queries from sqlalchemy to syslog.
I've read ...
3
votes
1answer
48 views
Flask-SQLAlchemy Can't Create Relationship - SAWarning
I used fbone to start this project off and I'm using its implementation of a Flask-SQLAlchemy column extension named DenormalizedText. I get the concept of this and how it works (not my issue) but my ...
0
votes
1answer
17 views
pass in table name to sqlalchemy query through url in flask
In short, how do i
var="TableName"
models.var.query.all()
explanation
My goal is to allow the user to change the order of list of items.
I set up an ajax call that sends an array of id's to the ...
1
vote
0answers
37 views
Many to many join with multiple database connections using Flask-SQLAlchemy
I am having issues making many-to-many join work with multiple database connections using Flask-SQLAlchemy as in Many-to-many multi-database join with Flask-SQLAlchemy but with a little twist, one ...
3
votes
0answers
74 views
Flask-SQLAlchemy many-to-many ordered relationship in hybrid_property
I am trying to get the first object out of an ordered many-to-many relationship using Flask-SQLAlchemy.
I would like to accomplish this using hybrid properties, so I can reuse my code in a clean way.
...
1
vote
0answers
34 views
flask-security how to create a group role user model
I am using flask-security for a website. The flask-security example shows how to setup a basic user role model, however, I would like to setup a group, user, role model where I can assign users to a ...
0
votes
0answers
26 views
error 'function sum(character varying) does not exist' using sum with SQL Alchemy and Postgres
I get the following error when attempting use func.sum in my SQL Alchemy query:
ProgrammingError: (ProgrammingError) function sum(character varying)
does not exist LINE 1: SELECT airs.trip_type ...
0
votes
0answers
57 views
Python Dates not working with MySQL Date coulmn
I am running a flask based web service and using python.
Configuration:
Python - 2.7.3
MySQL - 5.5.31
Linux - 12.04.2
We have integrated to send a mail to a particular user only 2 times and we are ...
0
votes
1answer
14 views
Saving SQLAlchemy models to file
I'm coming from EntityFramework. I'm used to creating my db, running EF, and having a bunch of class files generated for each of my db objects (usually tables) filled with properties (usually ...
0
votes
0answers
9 views
SQLAlchemy raises UnicodeEncodeError when committing binary data
I am using MySQL with Flask-SQAlchemy
Here is the error I am getting:
StatementError: 'ascii' codec can't encode characters in position 32-37: ordinal not in range(128)
(original cause: ...
0
votes
1answer
29 views
Unable to connect to AWS MySQL RDS instance via Flask SQLAlchemy URI from Python Elastic Beanstalk
I am running into an issue where I am unable to connect to my RDS MySQL instance from my Flask app. I am using SQLAlchemy and everything is working locally but when I push my code to AWS I get the ...
0
votes
1answer
45 views
In python flask how to allow a user to re-arrange list items and record in database
I have a flask sqlalchemy bootsrap app.
My template renders a list of items in a table that I would like the user to be able to rearrange. The items get displayed through standard jinja2
{% for ...
0
votes
0answers
38 views
database management of Large Application in Flask
I am developing an application with subdomain support using Flask, SQLAlchemy. The general concept of that app is it has users that are from different cities of a contry and subdomains will be names ...
0
votes
1answer
29 views
flask-restless with mod_wsgi can't connect to MySQL server
I am trying to run a flask-restless app in apache using mod_wsgi. This works fine with the development server. I have read everything I can find and none of the answers I have seen seem to work for ...
0
votes
1answer
50 views
Improving view function in Flask
Below is an example of the page I'm making. In this example, I have two select fields that are used to filter the results on the right side when the submit button is pressed.
The way I solved the ...
1
vote
2answers
31 views
How do you update multiple values in flask-sqlalchemey?
How do you update multiple values?
predictions=Fixture_prediction.query\
.filter_by(user_id=user_id)\
.update(request.form['home_score'],request.form['away_score'])
This is the error I get:
...
1
vote
0answers
36 views
Flask-sqlalchemy use only one connection to mysql
I have Flask application with Flask-sqlalchemy extension.
All my requests are going through one connection to mySQL. So, if one of user get page with long query — all outhers are waiting for end of ...
1
vote
0answers
26 views
Using Flask-SQLAlchemy Event API to broadcast to Flask-SocketIO?
I'm a novice developing a simple multi-user game (think Minesweeper) using Flask for the API backend and AngularJS for the frontend. I've followed tutorials to structure the Angular/Flask app and I've ...
0
votes
1answer
24 views
GeoAlchemy ST_DWithin implementation
Hi! I need to implement a query using GeoAlchemy to get all the Points that are near a given Point (for example, within a 10 meter radius). For storing points, i am using Geography fields in my ...
0
votes
1answer
17 views
StatementError: SQLite Date type only accepts Python date objects as input
I am using Flask-Security, the code seems fine, but when inserting a data from register view it gives the bellow error. Since I made SECURITY_TRACKABLE = True I added some extra fields in my models ...
2
votes
1answer
34 views
Dynamically create and persist models in Flask - Sqlalchemy [closed]
I am writing a flask webapp. I need to be able to create a model based on user input and create a table based on the model. Further, I also want to be able to use that model later (after having ...
1
vote
1answer
21 views
SQL Alchemy Flask Delete
If I run the following query:
a = db.session.query(Submission).filter_by(id=todelid,deletioncode=todelcode).count()
and I print a, it returns 1.
However when I run the following:
...
0
votes
0answers
46 views
Flask & Python 3.4 - Database model errors
I have been wrestling with the models for my app for a while now. Every time I seem to 'fix' one thing, another breaks. From Googling and searching on here I have finally come to this, however, it now ...
2
votes
2answers
59 views
Flask-WTF form posts successfully but validation never occurs
I have been struggling around the WTF forms for quite a while now. But this error, never seems to go away. I When ever I try to run this code the form never validates
Views :
...
3
votes
1answer
86 views
Using JSON Type with Flask-sqlalchemy & Postgresql
Background: I am building a Flask App and I have stored my data into a postgresql database and within a JSON column type.
Task: In my view functions, I would like to order a database query by ...
0
votes
1answer
53 views
Flask-migrate multiple models.py
I've a question related to Flask-migrate.
I'm creating a set of web services with Flask. I've split each web service in his own package in a python application.
The application structure look like ...
0
votes
1answer
25 views
Flask sqlalchemy - error binding parameter 0
I'm learning to develop a web app with flask but now I'm stuck with this error using flask-sqlalchemy:
Original exception was: (InterfaceError) Error binding parameter 0 - probably unsupported type.
...
1
vote
1answer
22 views
How to __repr__ type unicode from database model
Working with Python 2.7.4 and flask-sqlalchemy on Win 7.
In my database I have for example model named šaš šuđa, how would I display in name with __repr__ in this current model.
class Car(db.Model):
...
0
votes
2answers
35 views
Can't seem to have the variable from another table - SQLAlchemy
I have these two classes but they cant seem to connect with each other. The error I get is :
OperationalError: (OperationalError) no such column: user_points.user_id
Any ideas why this is?
class ...
0
votes
0answers
20 views
Creating index for json attribute
In sqlalchemy with postgres, how do I create an index on an attribute inside a json type field?
This didn't work:
Index("tablename.jsonfield.mykey.index", "'jsonfield'->>'mykey'")
0
votes
0answers
40 views
How to obtain the image path/ url from a file uploaded on an openshift data dir to be stored in a postgresql database?
I am a self-taught programming newbie here so please bear with me. I am trying to create a site which allows users to upload their images on. With the patience of another user, I was able to get some ...
0
votes
2answers
28 views
Loading Flask Models from Postgres
I've got a Flask application set up using a postgres db and sqlalchemy. Unfortunately this is not the flask-sqlalchemy extension. While I am able to get the app to work with regular sqlalchemy, the ...
0
votes
1answer
18 views
flask-sqlalchemy model property to string
I have the following code:
from flask_sqlalchemy import SQLAlchemy
db = SQLAlchemy(app)
class Product(db.Model):
id = db.Column(db.Integer, primary_key=True)
name = ...
0
votes
0answers
27 views
How to set Eve resource and item calls to go through custom made deserialize function
I can't create my API to return datefields in JSON format. So I had to create a function to serialize it. dump_datetime function does that for me.
My problem now is that, I don't know how to make my ...
1
vote
1answer
33 views
Best practice: Where should re-usable queries be placed?
Short
I have re-usable SQLAlchemy queries in a Flask application, but I do not know where it's best to place them.
Longer
When reading basic tutorials, it becomes very clear how to create basic ...
0
votes
0answers
36 views
flask sqlalchemy association object: KeyError on appending
I'm working on a simple association between two entities in a Flask application. I have an entity Game and an entity Tactic. A Game can employ many Tactics, and a Tactic can be employed by many Games. ...
0
votes
1answer
58 views
How to create a folder on openshift for a site that allows users to upload images
Hello and sorry (programming newbie here)! I am creating a site using Flask and SQLalchemy with postgresql where users can upload images. As of now, I'm stuck figuring out as to how to implement or ...