Why am I getting “NameError: Module ‘dashboard_permission’ has no mapped classes registered under the name ‘_sa_instance_state'”?
Problem I have a database with tables named qs_dashboard and profile which are linked with an intermediate table named dashboard_permissions. My issue is that when I try to add a relationship in my SQLAlchemy models from Dashboard to Profile via dashboard_permissions.profile_id, I get the following error whether or not my code is testing the new […]
Why am I getting “NameError: Module ‘dashboard_permission’ has no mapped classes registered under the name ‘_sa_instance_state'”?
Problem I have a database with tables named qs_dashboard and profile which are linked with an intermediate table named dashboard_permissions. My issue is that when I try to add a relationship in my SQLAlchemy models from Dashboard to Profile via dashboard_permissions.profile_id, I get the following error whether or not my code is testing the new […]
Why am I getting “NameError: Module ‘dashboard_permission’ has no mapped classes registered under the name ‘_sa_instance_state'”?
Problem I have a database with tables named qs_dashboard and profile which are linked with an intermediate table named dashboard_permissions. My issue is that when I try to add a relationship in my SQLAlchemy models from Dashboard to Profile via dashboard_permissions.profile_id, I get the following error whether or not my code is testing the new […]
Why am I getting “NameError: Module ‘dashboard_permission’ has no mapped classes registered under the name ‘_sa_instance_state'”?
Problem I have a database with tables named qs_dashboard and profile which are linked with an intermediate table named dashboard_permissions. My issue is that when I try to add a relationship in my SQLAlchemy models from Dashboard to Profile via dashboard_permissions.profile_id, I get the following error whether or not my code is testing the new […]
sqlalchemy.exc.MissingGreenlet: greenlet_spawn has not been called
I am using FastAPI + SQLAlchemy. I have a table User
SQLAlchemy: Error can’t emit change event
So, I have these 2 dto classes:
How do I reuse columns between tables in SQLAlchemy 2?
I have some very common columns I’d like to share between different tables, but no special relationships between them. For example “created_at”. I think the right approach is concrete table inheritance but I’m not sure.
The base class would be there only for code-reuse, and will not have its own table.
This is all assuming I’m using the type-annotated sqlalchemy 2.0 approach, e.g. perhaps do something like that (see below). What is the right approach?
SQLAlchemy: AssociationProxy/HybridProperty returning a list of unique elements of proxied list
Considering the following MRE:
SQLAlchemy scalars and intersect anomaly
The SQLAlchemy manual says* that the Session.scalars()
method returns ORM objects.
Is it possible to log multiple states of the same object using SQLAlchemy?
I am trying to use SQLAlchemy to repeatedly log what is happening to one object. Some example code is below Which demonstrates my aim.