gothinkster / flask-realworld-example-app

Exemplary real world JSON API built with Flask (Python)
https://realworld.io/
MIT License
902 stars 308 forks source link

Feed view is not working properly with sqllite #22

Open yarsanich opened 5 years ago

yarsanich commented 5 years ago

Hi,

Thanks for Flask implementation of realworld backend app.

I tried to launch it with sqllite as db. I got an error on feed view.

https://github.com/gothinkster/flask-realworld-example-app/blob/b49f3014f98c8a62ab2ba079b8e8dd11e96180a2/conduit/articles/views.py#L118-L120 returned

AttributeError: 'AppenderQuery' object has no attribute 'is_selectable'

I saw that UserProfile follows relation has defined join, but looks like it is not working properly. I did not try to launch it with PostgreSQL, maybe issue related to DB.

Explicit join works fine

return Article.query.join(UserProfile).join(followers_assoc, (followers_assoc.c.followed_by == Article.author_id)).\
        filter(followers_assoc.c.follower == user_profile_id).\
        order_by(Article.createdAt.desc()).offset(offset).limit(limit).all()