You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have some questions for the pagination which support SQLAlchemy 2.0 select syntax.
I used to use the old one (1.4) which takes Query object for pagination so that If I query an "A" table and join "B" table then the pagination.items would return both object of these A and B tables (Even I flat the table into columns, I got columns dictionary).
But after I upgrade SQLAlchemy from 1.4 to 2.0 and trying to using 2.0 syntax where is Select, With above example, I only got "A" table object (If flat to columns, I only got the first column of the statement).
(The implementation between SelectPagination and QueryPagination has alot of different from .scalars() and .all())
And I knew If I declare relationship between "A" and "B" tables gonna work, but If there are too many join and not that all feature using all the join relationship. Therefore what I want is to join some specific table in specific scenario in that moment and join others for other scenario.
Is any way I can using 2.0 select without scalars pagination?
Or I saw a property method selectable in Query class which convert Query object to Select. Is any possible to do it reverse?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi All :-)
I have some questions for the pagination which support SQLAlchemy 2.0 select syntax.
I used to use the old one (1.4) which takes
Query
object for pagination so that If I query an "A" table and join "B" table then thepagination.items
would return both object of these A and B tables (Even I flat the table into columns, I got columns dictionary).But after I upgrade SQLAlchemy from 1.4 to 2.0 and trying to using 2.0 syntax where is
Select
, With above example, I only got "A" table object (If flat to columns, I only got the first column of the statement).(The implementation between
SelectPagination
andQueryPagination
has alot of different from.scalars()
and.all()
)And I knew If I declare relationship between "A" and "B" tables gonna work, but If there are too many join and not that all feature using all the join relationship. Therefore what I want is to join some specific table in specific scenario in that moment and join others for other scenario.
Is any way I can using 2.0 select without scalars pagination?
Or I saw a property method
selectable
inQuery
class which convertQuery
object toSelect
. Is any possible to do it reverse?Beta Was this translation helpful? Give feedback.
All reactions