flask-sqlalchemy Questions
4
A simple query looks like this
User.query.filter(User.name == 'admin')
In my code, I need to check the parameters that are being passed and then filter the results from the database based on th...
Hellraiser asked 11/5, 2017 at 23:0
6
Solved
I'm trying to programmatically build a search query, and to do so, I'm joining a table.
class User(db.Model):
id = db.Column(db.Integer(), primary_key=True)
class Tag(db.Model):
id = db.Column(...
Riess asked 6/3, 2016 at 16:1
2
Solved
I wrote a Flask-SQLAlchemy model class that looks like this (from this reference):
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
app = Flask(__name__)
db = SQLAlchemy(app)
class...
Treharne asked 26/5, 2021 at 20:12
3
Solved
I'm trying to do some operations after an insert occurs on a particular table.
user = ModelFactory.create_user(username, email, password)
db.session.add(user)
db.session.commit()
So I have creat...
Florid asked 2/4, 2017 at 4:9
7
Solved
I've defined a table named users_table and ran db.create_all() to create the table, but get the error no such table user_table on commit for updating user info.
How I test :
(under /project) python...
Schleicher asked 6/7, 2017 at 6:55
1
I have two Flask apps running with a domain dispatcher (based on this guide).
I'd like to share my models between the apps. Is it safe to have the SQLAlchemy object in a shared location and just ca...
Elect asked 7/6, 2020 at 2:39
1
error: Incompatible types in assignment (expression has type "Type[Any]", variable has type "DefaultMeta") [assignment]
error: Variable "application.models.BaseModel" ...
Homeopathist asked 18/3, 2023 at 6:54
2
Solved
When I am trying to do
alembic upgrade head
I am getting this error:
ERROR [alembic.util.messaging] Online migration expected to match one row when updating '3aae6532b560' to 'a1d8dae7cc' in '...
Samsara asked 7/7, 2016 at 14:40
15
Solved
Tried running a file with the following imports:
from flask_sqlalchemy import sqlalchemy
from sqlalchemy import create_engine
from sqlalchemy.orm import scoped_session, sessionmaker
Received the...
Elude asked 31/7, 2018 at 18:46
12
I'm using Flask with Flask-SQLAlchemy and Flask-Migrate to create an application, however when I try to create a migration nothing happens.
I've created two tables in app/models.py:
from flask i...
Condone asked 10/8, 2018 at 9:27
8
Solved
I'm using Flask-SQLAlchemy to query from a database of users; however, while
user = models.User.query.filter_by(username="ganye").first()
will return
<User u'ganye'>
doing
user = model...
Centaury asked 15/5, 2013 at 19:8
4
Solved
I'm using SQLAlchemy for Flask to create some models. The problem is, nearly all my columns need nullable=False, so I'm looking for a way to set this option as default when creating a column. Surel...
Royalty asked 8/4, 2015 at 18:28
4
I'm trying to develop a web api using flask and sqlite. For communication with db I'm using sqlalchemy.
In the code that I post below I have create a GET method to retrieve all data into a specifi...
Graphics asked 3/3, 2016 at 14:3
5
I have a model Region and each Region can have sub-regions. Each sub-region has a field parent_id which is the id of its parent region. Here is how my model looks like
class Region(db.Model):
__t...
Randolphrandom asked 29/12, 2013 at 21:15
4
Solved
I'm trying to integrate PostgreSQL and SQLAlchemy but SQLAlchemy.create_all() is not creating any tables from my models.
My code:
from flask import Flask
from flask.ext.sqlalchemy import SQLAlc...
Schaaf asked 23/12, 2013 at 13:9
1
I getting this error:
sqlalchemy.exc.NoReferencedColumnError: Could not initialize target column for ForeignKey 'title.id' on table 'post': table 'title' has no column named 'id'
when I remove...
Kulak asked 29/9, 2019 at 4:26
7
We're using SQLAlchemy and Alembic (along with Flask-SQLAlchemy and Flask-Migrate). How to check if there are pending migrations?
I tried to check both Alembic's and Flask-Migrate's documentation ...
Flintshire asked 27/12, 2016 at 10:24
6
I am trying to execute 'flask run' in the Downloads directory where my Flask_App resides. My Flask_App is 'applications.py'. When I execute 'flask run' in the development environment I am getting a...
Canonicity asked 27/7, 2019 at 23:8
1
I am trying sqlalchemy with pytest, and having the following issues
@pytest.fixture(scope='function')
def my_session(my_db, request):
from my.models import Session, Base
Base.metadata.bind = my...
Sanguinary asked 5/6, 2016 at 20:17
2
(.venv) PS C:\Users\HP\Desktop\Projects\Python Based\Web Framework\Flask\LoginPage> flask run --debug
Usage: flask run [OPTIONS]
Try 'flask run --help' for help.
Error: While importing 'app', an...
Horvath asked 13/10, 2023 at 14:16
2
Solved
For example I am using the chinook database and I would like to convert the Name field into a slug. Slugify is a function from awesome-slugify.
Something like this in SQL
Select *, slugify(Name) ...
Bitterling asked 12/1, 2017 at 1:17
8
Firstly, I'm following the Python Flask tutorial posted here: https://scotch.io/tutorials/build-a-crud-web-app-with-python-and-flask-part-one.
Everything was working smoothly up to the 'Migration'...
Headlong asked 3/1, 2017 at 11:35
2
Solved
I'm working on forum template using Flask. When I attempt creating a new thread in the browser using forms, SQLAlchemy throws an AttributeError. The problem showed up when I tried implementing a on...
Decentralization asked 22/4, 2013 at 16:12
4
Solved
I found this regarding Point type in Postgres: http://www.postgresql.org/docs/current/interactive/datatype-geometric.html
Is there the SQLAlchemy version of this?
I am storing values in this mann...
Fat asked 15/5, 2016 at 0:3
2
I am trying to execute a stored procedure on Mysql database with sqlalchemy.
It runs fine from the shell but throws this error:
OperationalError: (MySQLdb._exceptions.OperationalError) (1568, "T...
Tala asked 24/7, 2019 at 15:43
1 Next >
© 2022 - 2024 — McMap. All rights reserved.