Skip to main content

All Questions

Tagged with
0 votes
0 answers
45 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 ...
Md Minhazur Rahman's user avatar
-1 votes
0 answers
48 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 ...
Lukas's user avatar
  • 543
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 ...
Fesisko's user avatar
  • 21
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. ...
aleks's user avatar
  • 87
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 ...
autumnweaver218's user avatar
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 ...
Wrichik Basu's user avatar
  • 1,373
-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=...
Stanislav's user avatar
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 ...
Irina's user avatar
  • 1,337
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 ...
franjefriten's user avatar
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 ...
Lifeable's user avatar
1 vote
0 answers
19 views

How can I modify the sqlalchemy query object's onclause directly?

I am using SQLAlchemy==2.0.37. I am developing an enhanced mixin and one of my needs is to modify the query object before compile. I have set up an event listener like so: @event.listens_for(Query, &...
Jake's user avatar
  • 196
0 votes
0 answers
58 views

Actual practical advantage of SQLAlchemy scoped_session vs classic session in worker

What is the actual practical advantage of using a scoped_session vs a normal session when using a contextmanager to handle opening and closing of the session at the appropriate times? In the following ...
Jan-Pieter's user avatar
0 votes
0 answers
32 views

SQLAlchemy error when creating table with foreign key

I have three tables, with one table having a foreign key referencing another. Table Appearance: class Appearance(Base): __tablename__ = 'appearances' appearance_id = Column(Integer, ...
coman's user avatar
  • 158
0 votes
1 answer
60 views

How do I select a recursive entity in sqlalchemy

I am saving a graph to a database. It has a structure like: class SuperNode(Base): __tablename__ = "supernodes" id = Column(Integer, primary_key=True) name = Column(String, ...
rasmus91's user avatar
  • 3,233

15 30 50 per page
1
2 3 4 5
1266