23,764 questions
0
votes
0
answers
43
views
"The connection is no longer usable because" sql server connection issue using python and sqlalchemy [closed]
Error code: "Exception: (pyodbc.OperationalError) ('08S01', '[08S01]"
Error message: "Very frequently i am facing this error. the connection get established i run multiple times after ...
-1
votes
0
answers
46
views
How to create list of UUID field
I need to create a list of UUID field:
from uuid import UUID
from sqlalchemy import UUID as saUUID
class Subsection(LastActionModelMixin, Base):
__tablename__ = "help_subsection"
id:...
0
votes
0
answers
26
views
Closing a session in Flask, SQLAlchemy to delete the temporaryx file
I know there are similar questions out there, but none answered my problem.
I am using a basic test setup in Flask using SQLAlchemy, that is a slightly modified version of the Flask-tutorial tests. My ...
0
votes
0
answers
49
views
sqlalchemy.exc.ProgrammingError: Invalid object name 'users' while querying SQL Server with pyodbc
I am running migration scripts via Alembic, and they are executing successfully. All the tables, including the users table, are created in the SQL Server database without issues. However, when I try ...
-1
votes
0
answers
25
views
postgresql sqlalchemy create_engine() choose a different schema [closed]
sqlalchemy python works perfect with schema "public" but if tried to access another schema, it just won't work. Tried "-c search_path=another_schema" in the url of create_engine(...
0
votes
0
answers
50
views
Spanner error while updating data into a JSON column
I am working with the GCP Spanner database using the sqlalchemy ORM. This is the table schema where I am trying to insert/update (based on a check) data into a JSON column:
from sqlalchemy import ...
0
votes
1
answer
31
views
How to query child tables belonging to particular parent
Is it possible to get one/all deep-nestend child tables in one-to-many hierarchy?
Say, a user has been logged.
u = db.session.execute(db.select(U).where(U.email == '[email protected]')).scalar()
And I'...
1
vote
1
answer
52
views
SQLAlchemy order by relationship column
I recently started working with SQLAlchemy and can't figure out how to properly write the following query, or maybe I need to rework the models.
Simplified, there are two tables: users and messages. ...
0
votes
1
answer
59
views
Type matching problem when trying to add rows using SQLAlchemy with 'sqlite' driver
I have simple example from a book about using SQLAlchemy on 1st level, which is close to DB-API. Since this book came out it's syntax changed and I have to modify code to have it worked. I have a ...
0
votes
0
answers
67
views
How to fix `InvalidRequestError: Can't attach instance <ClassName at 0x7baada2f3cb0>` in SQLAlchemy relationships?
I have already gone through quite a few answers on SO (eg. this one and this one, but none of them seem to work for me.
I am using SQLAlchemy with sqlite, python 3.13.3. In case it matters, this is ...
-3
votes
1
answer
54
views
sqlalchemy DML statement cannot have any enabled triggers
I'm using SQLAlchemy and MSSQL 2019 with triggers (insert/update) can't remove .
engine_new = create_engine('mssql+pymssql://***:***@***/***', implicit_returning=False)
Session_new = sessionmaker(bind=...
-1
votes
0
answers
30
views
pymysql too late compared with sqlAlchemy when 'SELECT' query
i used pymysql in my server with mysql
and the table has about 0.2 billion rows and multi PK (suppose that a, b, c col)
when i use pymysql with "SELECT * FROM table WHERE a='0' and b='1', and c='...
0
votes
0
answers
12
views
SQLAlchemy session.query(object) returns automap object without __dict__ [duplicate]
I follow up this tutorial and got an error.
Code:
engine = create_engine("sqlite:///mydatabase.db")
# reflect the tables
Base.prepare(autoload_with=engine)
# mapped classes are now created ...
0
votes
1
answer
51
views
Can't inspect database when using sqlalchemy
I have a postgres database inside a docker container. I compose it up with this docker-compose.yaml:
services:
db:
container_name: postgres
image: postgres:latest
restart: always
...
0
votes
1
answer
51
views
sqlite3.OperationalError: unable to open database file in virtual enviornment
I am trying to access a database named 'app.db' through sqlite3.connect() using a config with the URI of the file. I am also running this in a virtual enviornment and I am on windows.
Here is where I ...