I use python SQLAlchemy 2.0 ORM in declarative style to define my tables like such:
from sqlalchemy.orm import DeclarativeBase
from sqlalchemy import select
class Example(DeclarativeBase):
__tablename__ = 'example'
foo = mapped_column(Text, nullable=False)
I know that I can access table column in queries using "dot notation":
select(Example.foo).select_from(Example)
Is there some way to also access tables using "bracket notation"? This might look like the following:
select(Example['foo']).select_from(Example)
This ended up working for me:
select(Example.__table__.c['foo']).select_from(Example)