Questions tagged [flask-sqlalchemy]

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.

0
votes
0answers
3 views

Customising the ID used in Marshmallow URLFor

I am using a Sqlite database, and flask, marshmallow, sqlalchemy to serve as a web api for a front end project. I'm using a UUID stored as a blob in the database, and trying to stylise the data when ...
0
votes
0answers
9 views

Flask-SQLAlchemy: SQLALCHEMY_ENGINE_OPTIONS not set up correctly

I just updated my projects Flask-SQLAlchemy Version to the latest one (v2.4). As some of the SQL-Alchemy config parameters were deprecated, I now follow the documentation and added ...
0
votes
0answers
7 views

How to register dynamically created tables in metadata

I have a sqlite database behind my flask application in which I upload tables from csv files using the pandas to_sql function. All tables are correctly uploaded into my database, but not registered in ...
0
votes
0answers
9 views

Failed to find Flask application or factory in module “config” Use "FLASK_APP=config:name to specify one

I'm install Flask-SQLAlchemy in a virtual environment. I'm install Flask-Migrate: pip install flask-migrate Created a class config.py: import os basedir = os.path.abspath(os.path.dirname(...
0
votes
2answers
11 views

Flask SQLAlchemy custom field name for foreign key?

Relationship = Many Heros have one Planet. I'd like to be able to call hero.home_planet because the Star Wars characters move around in space a lot. But under my model, the field is called planet_id. ...
0
votes
1answer
7 views

How to perform operation on flask-admin database columns to store results in other column of same table

I am building flask admin app where I need to store total of couple of integer columns into third column of same table. from flask_sqlalchemy import SQLAlchemy from flask_admin.contrib.sqla import ...
-1
votes
1answer
16 views

How to populate HTML fields from database data using Flask [duplicate]

I want to fetch data from a database using flask-alchemy, based on a string value I have passed from another screen. But here's the problem, I get a 400 error for my password and I don't know what I'm ...
0
votes
1answer
35 views

How to query all users that share atleast one college

I want to query all users that share at least one similar attribute/content (in this case, college). models.py class User(db.Model): id = db.Column(db.Integer, primary_key=True) username = ...
0
votes
0answers
13 views

Sqlalchemy returning relationship with nested join using marshmallow

Currently I have a bunch of tables with clear relationships set up. However, I want one table (Application) that has a relationship to an Answer table and a Question table to only show answers that ...
0
votes
1answer
36 views

Flask cannot connect to RDS MySQL

I used flask-sqlalchemy with PostgreSQL. Now, I switched to RDS MySQL, so I changed SQLALCHEMY_DATABASE_URI form app.config['SQLALCHEMY_DATABASE_URI'] ='postgres://**************' to app.config['...
0
votes
0answers
17 views

Sql alchemy only load relationship explicitly

How do i make sql alchemy only joinload relationships when i explicitly state in the query as well as the load depth. I am dealing with a many to many two way relationship. I want to load the ...
0
votes
1answer
28 views

Why is SQLALCHEMY_DATABASE_URI set to “sqlite:///:memory:” when I set it to a path in my Config?

I am learning Flask by following Miguel Ginsberg mega tutorial chapter 4. When I run any Flask command from the Anaconda command panel I get an error that includes "Neither SQLALCHEMY_DATABASE_URI nor ...
0
votes
0answers
17 views

DetachedInstanceError in flask-sqlalchemy streaming responses

I'm using flask-sqlalchemy while constructing a streamed zip archive following these examples: https://tilns.herokuapp.com/posts/9b9c0d06d7-generate-and-stream-zipfiles-on-the-fly-with-flask http://...
0
votes
0answers
15 views

SQLAlchemy DB not created on the filesystem

Before closing this is a duplicate please review the issue. I'm working through a python tutorial with the following ORM model. from views import db import datetime class Task(db.Model): ...
-1
votes
0answers
20 views

flask lost connection to mysql server during query / Got an error reading communication packets

I launched my first site on flask / SQLalchemy / MySQL. When I was testing myself I never had an error, but now I notice it crashes when loading a page from the db (I print the parameters they look ...
-2
votes
1answer
51 views

create_engine() missing 1 required positional argument: 'engine_opts

app was running fine yesterday at home on a different system **when i tried to run it on the different system ( **freshly installed everything ) - so i assume that this error is just for the latest ...
1
vote
0answers
19 views

Problem with Database ”Could not parse rfc1738 URL from string”

Error: Could not parse rfc1738 URL from string. I tried everything, I think and I cannot solve it. app.config['SQLALCHEMY_DATABASE_URI'] ='C:/dev/FlaskBlog/blog.db' db = SQLAlchemy(app) class ...
1
vote
1answer
76 views

SQLAlchemy won't find the column in my table even after updating DB?

When I run my code, I receive this error: sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) no such column: user.about [SQL: SELECT user.id AS user_id, user.username AS user_username, user....
0
votes
1answer
18 views

get column names from variables sqlite python3 sqlalchemy

I want to store the details stored in x variable to the sqlite database using flask sqlalchemy. How to make it possible. Here's the code i wrote: from flask import Flask from flask_httpauth import ...
0
votes
1answer
30 views

I keep getting “ERROR [root] Error: Can't locate revision identified by '5b11851f8dd8'”

ERROR [root] Error: Can't locate revision identified by '5b11851f8dd8' I am trying to use flask-migrate with a sqlite database and when I migrated I got the above error. This is all coded on pycharm. ...
0
votes
0answers
21 views

API ERROR: instance of 'scoped_session' has no 'execute' member

I've been trying to develop an API in Python using flask-sqlalchemy but it's not working on the Mac. I'm trying to access a database, but the code that should work shows "instance of 'scoped_session' ...
1
vote
0answers
23 views

sqlalchemy compile error:can't generate DDL for NullType()

Error: sqlalchemy.exc.CompileError: (in table 'person', column 'id'): Can't generate DDL for NullType(); did you forget to specify a type on this Column? I use SQLite but cannot make a table from ...
0
votes
3answers
28 views

How can I initialize the database automatically with SQLalchemy and Alembic?

Currently, I run $ flask db init $ flask db migrate -m "initialization" $ flask db upgrade if the database does not exist. I would like to run this within Python, e.g. something like app.create_db()...
-1
votes
1answer
18 views

Importing multiple models in create_app method

I have a base flask app that I have put together to build future projects from. I have it set up with an application factory method "create_app". https://github.com/thenetimp/flask_base_v2/blob/...
0
votes
0answers
10 views

Why am I getting this SSL Error when running flask application on HTTPS

I have a flask application which I am trying to run on https, at the moment I am just using ssl_context='adhoc' for the moment. The application launches, but when I go to any pages that are ...
0
votes
2answers
33 views

How do I dynamically create forms with Python Flask

I have a large model which I have defined in my models.py file and I have the form which serves it. Do I have to explicitly state each field for the form or is there a way to dynamically create this ...
0
votes
1answer
25 views

Querying multiple related tables with join to generate single table using sqlalchemy

I am working on a web app which manages the inventory system and selling books and items. I want to generate the monthly based report on how many books where sold and ordered to Inventory in given ...
0
votes
1answer
27 views

python 2.7 + flask-sqlalchemy, flask marshmallow + DB relations throws error foreignkeyconstraint and primary join

I have existing DB dataset that has these tables already: owners table that has ownerid as primary_key another table owndnis whose primary_key is the same ownerid one other table whose primary_key ...
2
votes
1answer
38 views

How do I efficiency create big forms - FlaskForms

So I have an update form end point, which is very large, I've tried a few things to make it dynamically created to condense my code but I cant seem to figure it out. @customers.route("/<int:...
0
votes
0answers
32 views

Load all columns of related table | Flask-SqlAlchemy

I have following Flask-SqlAlchemy schema. A Territory can have multiple AsmStores associated with it and I want to load all the columns of related entity (AsmStore) when I query for Territory. I have ...
0
votes
1answer
38 views

Looping through over 6k results, want to update a linked table, worried about time taken

I'm working on a pre-existing application written in Python using Flask and SQLAlchemy (I did not create this application). I need to update just over 6k rows. A row from the main table (called ...
0
votes
0answers
34 views

How to configure Flask-Session with SQLAlchemy to store Flask session on server-side

I working on a Flask application that is deployed on heroku. The application uses Flask-Session I need help to configure the server side session storage correctly. I've first configured it to store ...
0
votes
0answers
26 views

Flask app gives a “ 'NoneType' object has no attribute 'drivername' ” error

I got a VPS and I wanted to host my flask app there. I followed DigitalOcean's tutorial on "How To Serve Flask Applications with Gunicorn and Nginx on Ubuntu 18.04" (I didnt get the VPS from DO) and ...
0
votes
1answer
33 views

Result of database query won't load into flask template

I changed the way I'm querying the database and although the result loads fine I cant get the information to show up in the template. I tried rewriting the code in a simpler way to try and catch ...
-1
votes
1answer
29 views

Error in inserting new data with Oracle and sqlalchemy

I have a 1-1 relationship of two tables/objects, using flask-sqlalchemy. I am trying to insert a new row for one of them (referencing through a FK a row in the first table) and it fails. Same code ...
0
votes
1answer
27 views

How to make func.sum and group_by to output sum of the rows and merge the duplicate rows using sqlalchemy

I want to generate a table which sums the number of books that are sold and the total amount paid for that distinct book in a given period of time. I need it to show a report of books that are sold. ...
2
votes
1answer
68 views

Flask_SQLAlchemy Cannot reflect Database like SQLAlchemy

I'm trying to connect Foreigner Database to a python-Flask app using Flask_SQLALchemy I looked everywhere including the FLASK_SQLALCHEMY official doc I've been looking everywhere over the internet ...
0
votes
1answer
39 views

Pre-populate a Flask SQLAlchemy database

I have two models, one is Identification which contains two IDs (first_id and second_id) and the second is User. The idea is that only authorised users will be given their first_id and second_id pair ...
-1
votes
0answers
18 views

(sqlite3.OperationalError) no such table: blog_table [SQL: 'SELECT blog_table.title AS blog_table_title, blog_table

i want to display all the data from database to another page . i am new in flask and stuck in this problem from two days anybody who have knowledge of flask please help me. Here is the some code of ...
0
votes
0answers
30 views

Conversion from sql to sqlalchemy

I'm trying to create classes for sqlalchemy in order to make sqlalchemy create database Sometables. Here is SQL code: CREATE table "Sometable" ( id INTEGER UNIQUE NOT NULL PRIMARY KEY, name ...
0
votes
0answers
17 views

Deleting two relational table values in single view function in flask

I want to delete two table values in one view function in flask. class SampleOrder(db.Model): __tablename__ ='sample_orders' id = db.Column(db.Integer,primary_key=True) customer_id = db....
1
vote
1answer
33 views

Flask SQLAlchemy import DB import

I am using flask with SQLAlchemy, after set all configuration setting I got db import error on model. ImportError: cannot import name 'db' my main app __init__ from flask_api import FlaskAPI from ...
0
votes
0answers
16 views

Opt-out model columns from being serialized

I am using Flask, Flask-SqlAlchemy, Flask-Marshmallow and Marshmallow-SqlAlchemy among other frameworks to build an application. I have for example following model and schema classes. I need to opt ...
0
votes
0answers
12 views

Celery Beat Isn't Closing the db Connection After db.session.close()

I am running a single celery beat task which queries one table and updates another. I end the task with a db.session.close() but the session remains open and eventually crashes my db instance when the ...
0
votes
1answer
35 views

How to insert a Pandas Dataframe into a SQL Server synonym table

Summary In SQL Server, synonyms are often used to abstract a remote table into the current database context. Normal DML operations work just fine on such a construct, but SQL Server does track ...
0
votes
0answers
31 views

How to use flask-sqlalchemy with multiprocessing?

I want to use flask-sqlalchemy with multiprocessing, but some error happened. app.py app = Flask(__name__) with app.app_context(): db.init_app(app) db.create_all() queue = Queue() dealer = ...
1
vote
0answers
35 views

SQLAlchemy query API not working correctly with hints

I'm trying to use the query API to create a MySQL query with the the MAX_EXECUTION_TIME(30000) hint. My code is roughly: from flask_sqlalchemy import SQLAlchemy class MyTable(SQLAlchemy().Model): ...
0
votes
0answers
11 views

How can I use sqlalchemy's create_all function on a specific PostgreSQL schema?

I am using Python 3.7.2 with Flask 1.0.2 and PostgreSQL 10.6. I am attempting to use the schema feature for a multitenant database. My question is: can I use create_all or something similar to apply a ...
0
votes
0answers
10 views

Sqlalchemy: send the result to js for further work with html page

Maybe someone will throw ideas on how to do this or maybe someone has a solution. I need to change the data in the table when I click on an item from the list of all this from html. list: <...
-3
votes
1answer
34 views

API design in Python using mssql [closed]

I am currently accessing mssql database using pymssql from python Here is my code : import pymssql as pms _dbcon = pms.connect(server, username, password, database, charset='UTF-8') _cur = _dbcon....

http://mssss.yulina-kosm.ru