[sqlalchemy] Re: Orm, join 1 row from many2many table when querying

2016-11-10 Thread Dorian Hoxha
Note that you're joining with User, which I don't want. Only the "like" is needed. I'll try to change it to only query/join the like. On Thursday, November 10, 2016 at 10:32:45 AM UTC+1, Dorian Hoxha wrote: > > So I have: > > class Thing(): > current_user_like = rel

Re: [sqlalchemy] Orm, join 1 row from many2many table when querying

2016-11-10 Thread Dorian Hoxha
hu, Nov 10, 2016 at 11:53 AM, Simon King <si...@simonking.org.uk> wrote: > On Thu, Nov 10, 2016 at 9:32 AM, Dorian Hoxha <dorian.ho...@gmail.com> > wrote: > > So I have: > > > > class Thing(): > > current_user_like = relationship(Like) > > > >

[sqlalchemy] Orm, join 1 row from many2many table when querying

2016-11-10 Thread Dorian Hoxha
So I have: class Thing(): current_user_like = relationship(Like) class User(): pass class Like(): user_id = Column(primary_key=True) thing_id = Column(primary_key=True) Now I want, to do "session.query(Thing).all()" and also join the "current_user_like" for each Thing, but

Re: [sqlalchemy] postgresql array column, fetch only_load() element by index

2016-11-08 Thread Dorian Hoxha
Hi Simon, It all works. All I need is how to do: Model.query.options(load_only(Model.array[1])).all() ? Thanks On Tue, Nov 8, 2016 at 10:56 AM, Simon King <si...@simonking.org.uk> wrote: > On Tue, Nov 8, 2016 at 9:31 AM, Dorian Hoxha <dorian.ho...@gmail.com> > wrote:

[sqlalchemy] postgresql array column, fetch only_load() element by index

2016-11-08 Thread Dorian Hoxha
So, I want to do "SELECT array[1] FROM table;". Meaning to select only 1 element. Is this possible (didn't find by searching docs,mailing-list,google). Though I can do it by normal query. Thank You -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper

[sqlalchemy] Specifying itersize when streaming_results=True for psycopg2 driver ?

2015-04-08 Thread Dorian Hoxha
I searched documentation, mailing list, issue-list, code (on github), google, and couldn't find for a way to set the iterszie, the number of rows to get on each batch when streaming results with psycogp2. Is it possible ? In psycopg2 docs:

How to use alembic on multiple computers ?

2014-07-08 Thread Dorian Hoxha
So I'm using flask-migrate, that is a simple wrapper to alembic. Is the write way to use alembic on both computers (so migrations work correctly on both) by doing: 1. init on pc1 with a clean db and an existing models.py file 2. migrate and upgrade on pc1 3. export db and import on