Questions tagged [sqlalchemy]

0 votes
2 replies
How to access psycopg2 error wrapped in sqlalchemy error
I'm uploading a pandas data frame to a table in Postgres using SQLalchemy and psycopg2. How do I access the psycopg2 error that is within the SQL...
0 votes
0 replies
SQLAlchemy Group By Relationship and return Model instance
I have the following SQLAlchemy query that groups by projects id TimeEntry.query.with_entities(func.sum(TimeEntry.minutes), TimeEntry.project_id...
asked 1 month ago
0 votes
1 replies
Sqlalchemy: add into mysql table new rows from pandas dataframe, if they don't exist already in the table
I created a table inserting data fetched from an api and store in to a pandas dataframe using sqlalchemy. I am gonna need to query the api, every...
asked 1 month ago
3 votes
0 replies
SQLAlchemy requires query to be aliased yet that alias is not used in the generated SQL
I have a simple model class that represents a battle between two characters: class WaifuPickBattle(db.Model): """Table which represents a wh...
asked 1 month ago
0 votes
0 replies
How to get specific columns data from Postgres database in SQL Alchemy
I working on Postgres and begin with SQL Alchemy. I have created "layout_api.py" layout_api.py from sqlalchemy import create_engine from sqlalc...
asked 1 month ago
0 votes
0 replies
Parent instance is not bound to a Session; lazy load operation of attribute ’account’ cannot proceed occasionally
SQLAlchemy version: 1.0.17 for example: class A(Model): id = ..... b = relationship('B') a = db.session.query(A).options(joinloaded(B)...
asked 1 month ago
0 votes
0 replies
SQLAlchemy filter according to list elements in JSONB
I have a JSONB column defined in Postgres and data inside looks like: {'related_ids': ['a', 'b', 'c', 'd']} Currently, I have two records one...
asked 1 month ago
0 votes
0 replies
How to stop creating new nested rows during loading
I serialize/deserialize my data with marshmallow-sqlalchemy. When I try to deserialize following data (Model2 with id=1 is present in the databa...
asked 1 month ago
0 votes
1 replies
Download CSV File in Flask Best Practice
Right now I have a flask app in which part of the functionality allows me to select a date range and see data from a sql database from that selec...
asked 1 month ago
0 votes
0 replies
sqlalchemy - DetachedInstanceError when using a session as a contextmanager with sqlite
I'm sure there is a duplicate somewhere but just couldn't find it. If you do, please mark this question as duplicate. Consider a very basic mode...
asked 1 month ago
1 votes
1 replies
How to properly run consecutive tests querying a Flask-SQLAlchemy database?
I'm setting up unit-testing for a Flask project using SQLAlchemy as ORM. For my tests I need to setup a new test database every time I run a sing...
0 votes
1 replies
Relationship to “jump” through M2M relationships in SqlAlchemy (User -> Role -> Permission)
I am trying to model a very typical permission structure where a User model (the human user of my website) can be assigned to some Roles, and eac...
asked 1 month ago
0 votes
0 replies
SQLAlchemy upgrade hangs on azure
When attempting to make upgrades to a postgresql db on azure, the upload hangs for at least an hour with no error messages. flask db migrate ran...
0 votes
0 replies
SQL Alchemy to Pandas - Code previously worked on 2.7 and not on 3.7
I upgraded to python 3.7, and with that an updated version of SQL Alchemy. This code use to work fine to execute queries in py and set them into...
0 votes
0 replies
How to save many to many after use schema load
I'm trying to add a new user using marshmallow_sqlalchemy and sqlalchemy to my database. This user has a many to many relationship with my profi...
0 votes
0 replies
SQLAlchemy - return serialized backref values on Postgres
I have a SQLAlchemy database owned by Postgres: track model: class Track(db.Model): __tablename__='track' """ Model for storing tr...
asked 1 month ago
0 votes
0 replies
SQLAlchemy - Issue with session.execute and bindparams - sqlalchemy.exc.OperationalError: (sqlite3.OperationalError)
This code works absolutely fine but is vulnerable to SQL injection... ### WORKS FINE ### value = "whatever" statement = text(f"DROP VIEW {value}...
asked 1 month ago
-1 votes
0 replies
A way to store data offline and upload it to the database when it comes back online
Here's the scenario: every hour, I upload some data to the database, however, if the database goes offline for a couple of hours, I'd still like...
0 votes
0 replies
Services and flask_sqlalchemy inside a flask application
I'm building a large, complex Flask application. It has lots of route functions (which need to do database calls) and lots of services (which als...
asked 1 month ago
0 votes
0 replies
Flask Connect user to different Database
I'm trying to build a simple CRM where each logged-in user will have a form with some input for their database details where after a user submits...
asked 1 month ago
1 votes
0 replies
Using Factory Boy to define three interrelated models with Flask and SQLAlchemy
I'm trying to create FactoryBoy factories for three models with a complicated relationship in a Flask/SQLAlchemy site. The models are: from sqla...
asked 1 month ago
0 votes
1 replies
Dynamically inserting CSV data into dynamically created Tables
I'm trying to dynamically create tables and insert CSV data into them using sqlAlchemy. given a set of CSV's: FirstName, LastName Mike, Myers T...
asked 1 month ago
0 votes
0 replies
Will multiple func.count().filter() scan DB more than once?
I am developing an web application using pyramid web framework. I am using sqlalchemy for ORM and models. I am using postgres for DB. Here is my...
-1 votes
0 replies
(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 knowled...
asked 1 month ago
0 votes
1 replies
sqlalchemy: I can`t delete the record from the table - violates not-null constraint
I get the following error if I add 'relationship': (psycopg2.IntegrityError) null value in column \"robot_id\" violates not-null constraint...
asked 1 month ago