Questions tagged [sqlalchemy]
SQLAlchemy is a Python SQL toolkit and Object Relational Mapper that gives application developers the full power and flexibility of SQL.
17,508
questions
0
votes
0answers
16 views
How to keep connection with mariadb using SQLAlchemy? I got two parameters (pool_recycle, connect_args) what is difference of that?
I'm trying to connect mariadb using create_engine of sqlalchemy.
When I made connection like below, I sometimes got error that is "2006, MySQL server gone away".
from sqlalchemy import ...
0
votes
0answers
10 views
In sqlalchemy can we calculate a parent column as true if all its Child column are true
class Parent(Base):
__tablename__ = "Parent"
parent_id = Column(Integer, primary_key=True)
complete = Column(Boolean)
children = relationship("Child", ...
-1
votes
0answers
14 views
How do I find out if there are any strings matching sha1 hash of SALT + string in PostgreSQL using SQLAlchemy
How do I find out if there are any row where field matches sha1 hash of SALT + string in PostgreSQL using SQLAlchemy
0
votes
0answers
11 views
SQLAlchemy Multiple Join Paths.failed to locate the User class. SQLalchemy versioned_history
I'm having trouble with multiple join paths.
So I'm using Flask with
SQLAlchemy
Flask-authorize
Flask-login
and sqlalchemy versioned_history https://docs.sqlalchemy.org/en/14/orm/examples.html#module-...
0
votes
0answers
29 views
SQLAlchemy - How can I join tables with common foreign key?
I have the following tables.
CREATE TABLE transformer (
id_transformer TEXT PRIMARY KEY,
age INTEGER,
nominal_voltage REAL
);
/* MEASUREMENTS */
CREATE TABLE oil_quality (
...
0
votes
0answers
12 views
SQLAlchemy Single Table Multiple Models + Mixin
New to Python, SQLAlchemy and alembic.
Been trying to define a mixin:
class Mixin(Base):
__abstract__ = True
col_mixin_1 = ...
col_mixin_2 = ...
...
Then, define a common base class:
...
0
votes
0answers
20 views
Alembic autogenerate not detecting current state
Problem
I'm using Alembic autogenerate to migrate some model changes. I run alembic revision/upgrade once and it properly creates my table and adds an alembic_version table to my database. When I go ...
2
votes
1answer
25 views
AttributeError: 'Connection' object has no attribute 'is_connected'
I am working on a short project that deals with simple MySQL-python functions and came with an error. Using sqlalchemy, I have tried connecting MySQL and python but an error keeps popping up.
...
-1
votes
0answers
14 views
Passing data from flask backend to javascript in html file [duplicate]
Im trying to pass a list of users (sqlalchemy) from a flask backend into javascript within a html file.
I have tried passing it as a list of User objects and turning the list into json and passing it ...
-1
votes
0answers
21 views
Multiple conditions for joined the table's column in SQLAlchemy
I have two models:
class Room(Base, SerializerMixin):
__tablename__ = "rooms"
id = Column(String, primary_key=True)
last_updated = Column(Integer)
participants = ...
0
votes
0answers
28 views
Can infinity be stored in a SQLite JSON1 column? [duplicate]
Use Case
I'm using SQLAlchemy and SQLite for a standalone application (non-web) and I need to store numerical ranges in a database. I'm doing this by saving the start and end of each range in SQLite ...
-1
votes
1answer
19 views
SQLAlchemy not finding a table to generate a foreign key [closed]
Im working with 3 tables but failing when working with my third one, surf spot images. Im thinking it could be that Im missing a relationship?
The tables are:
towns: which have many surf spots,
surf ...
-3
votes
0answers
41 views
SQLlite order_by returning an empty list [closed]
I'd like to return the top ten score from the database but I get an empty list [,] in return instead.
from app.base.models import User, Description
@blueprint.route("/Leaderboard")
def ...
0
votes
0answers
22 views
sqlalchemy.exc.OperationalError sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) no such column:
CRUD application to add,show,delete records. I know the error is id = db.Column(db.Integer, primary_key = True).
If i change that to id = db.Column('student_id',db.Integer, primary_key = True) then ...
1
vote
0answers
34 views
No module named 'sqlalchemy'
There's an issue with from sqlalchemy.orm import relationship, when I try to run my app with that import, ModuleNotFoundError is raised and it says No module named 'sqlalchemy'.
But when I delete the ...