Hi 

I can successfully use pagination with the following - 

mydata=Article.query.filter(Article.author_id==User.id).filter(User.id==g.user.id).paginate(page,
 
POSTS_PER_PAGE, False)

However, I need to fetch columns from multiple tables. In that case how can 
I modify the code above in order to use pagination? 

Here is what I need to do - 

mydata = db.session.query("id","title","Author").from_statement("\
                                                     SELECT 
a.id,a.title,u.author \
                                                     FROM article a, user u\
                                                     where a.user_id=u.id \
                                                     and u.id=:userid")\
                                                    
 .params(userid=g.user.id).all()

However, with this , pagination does not work and I get an error 
- AttributeError: 'Query' object has no attribute 'paginate'


Can you please help?




-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to