All Questions
Tagged with flask flask-sqlalchemy
4,241
questions
0
votes
0
answers
15
views
Flask app builder extend base model and add extra column to it
I want to know how I can extend flask app builder base models. Example I have User model in flask_appbuilder/security/sqla
class User(Model):
__tablename__ = "ab_user"
id = Column(...
0
votes
0
answers
18
views
How to add extra column in Role model in apache superset
I am trying to extend Role model of apache superset and add channel_id as extra column. I have done it through superset_config.py and it looks like this.
import flask_appbuilder.const as c
import ...
0
votes
1
answer
28
views
Unable to import WTForm class from one file to another
I am unable to import NamerForm from forms.py to controllers.py. Getting ImportError
ImportError: cannot import NamerForm from application.forms
File Directory structure:
.venv
|____applications
|-...
0
votes
0
answers
20
views
AttributeError: module 'database.db' has no attribute 'Model'
app.py
from flask import Flask, jsonify
from flask_jwt_extended import JWTManager
from flask_migrate import Migrate
from flask_cors import CORS
import secrets
from api.user_controller import user_bp
...
0
votes
0
answers
36
views
How do I upload an Excel sheet and show its data on the page?
models.py (database schemas):
from app import db, login_manager
from flask_login import UserMixin
@login_manager.user_loader
def load_user(user_id):
return User.query.get(int(user_id))
class ...
0
votes
0
answers
30
views
How do I commit data from a flask form (inside of a modal) to an SQL Database?
I'm pretty new to Flask and struggling with transferring data from a form to an SQL Database. The form is within a modal, which works perfectly and will redirect back to the main page once the form is ...
0
votes
1
answer
28
views
How to use FileField within WTForms FieldList? Using Flask-WTF for FileField
I have created dynamic fields using WTForms FieldList, macros and Javascript.
Using this code to validate many fields (StringField, SelectField etc) I can add many fields dynamically, and they ...
0
votes
1
answer
33
views
Pinotdb error (pinotdb.exceptions.DatabaseError) {'errorCode': 150... when trying to initialize apache-pinot db from apache-superset
while setting up Apache-Superset (I installed Superset on Ubuntu 22.04 over pypi, for the connector im using pinotdb, to connect Superset to a apache-pinot db.) i encountered following error after ...
1
vote
1
answer
49
views
Even if SQLALCHEMY_POOL_RECYCLE is set, Flask-SQLAlchemy will not automatically recycle MySQL connections
Recently, my flask program encountered the error of Lost connection to MySQL server during query. I searched some documents and discussions. It seems that MySQL timed out and disconnected the ...
2
votes
1
answer
140
views
Why does flask seem to require a redirect after POST?
I have an array of forms I want rendered in a flask blueprint called fans. I am using sqlalchemy to SQLLite during dev to persist the data and flask-wtforms to render. The issue appears to be with ...
0
votes
1
answer
18
views
Flask-SQLAlchemy: declared_attr does change the __tablename__ but is pointing to or still accessing the same table
I have two tables, user and user_us in a sqlite file. Both the tables have the same structure. I tried to use a class and an inherited class to access both using declared attribute decoration. If the ...
0
votes
1
answer
62
views
Why aren't my tables listed by .table command?
I'm trying to make an SQLite database connection through Flask-sqlalchemy. I opened a command prompt where dbconnect.py is saved containing from dbconnect import app, db,Connect and db.create_all(). ...
0
votes
1
answer
37
views
Is it a must that my user model inherits from dm.Model before i can use UserMixin to handle login in python-flask?
I understand that this is the traditional way that people create user model in python-flask:
class User(db.Model, UserMixin):
id = db.Column(db.Integer, primary_key=True)
username = db.Column(...
0
votes
1
answer
38
views
Flask loop through a db query in jinja2 with filter
I have a category table and a post table. For each category there are many posts. There is a foreign key relationship between these two tables so that each row in the post table also has a column for ...
0
votes
1
answer
55
views
SQLAlchemy scoped_session provides the same session for each test
I'm a bit confused with SQLAlchemy scoped_session. It looks like session object is not recreated with every test case, even though I set up database fixture with 'function' scope.
I have an app ...