str_sql = sql.text("YOUR STRING SQL")
#if you have some args:
args = {
'myarg1': yourarg1
'myarg2': yourarg2}
#then call the execute method from your connection
results = conn.execute(str_sql,args).fetchall()
For joins if columns are not defined manually, only columns of target table are returned. To get all columns for joins(User table joined with Group Table:
sql = User.select(from_obj(Group, User.c.group_id == Group.c.id))
# Add all coumns of Group table to select
sql = sql.column(Group)
session.connection().execute(sql)
If you don't list any columns, you get all of them.
Should work.
Turns out you can do:
You can always use a raw SQL too:
The following selection works for me in the core expression language (returning a RowProxy object):
For joins if columns are not defined manually, only columns of target table are returned. To get all columns for joins(User table joined with Group Table:
Where Bar is the class mapped to your table and session is your sa session: