Re: [sqlalchemy] Bulk Inserts and Unique Constraints

2014-03-26 Thread Cosmia Luna
Wow, I didn't know that... is it a bug? But, the RETURNING clause will work though :) stmt = P.__table__.insert(returning=[P.id], values=[{"val": 1}, {"val": 2}]) with engine.connect() as conn: result = conn.execute(stmt) # do something with result hmm, maybe perfomance suffers from huge

Re: [sqlalchemy] [missing feature] joined relationship + order by: table alias problem

2014-03-26 Thread Michael Bayer
On Mar 26, 2014, at 1:56 PM, Staszek wrote: > On 2014-03-26 18:16, Michael Bayer wrote: >> It's not totally clear which of the common use cases you have here, pick one: >> >> 1. I want to emit a JOIN from User to Car and order by Car.model - don't use >> eager loading, use query.join(): > >

Re: [sqlalchemy] [missing feature] joined relationship + order by: table alias problem

2014-03-26 Thread Staszek
On 2014-03-26 18:16, Michael Bayer wrote: > It's not totally clear which of the common use cases you have here, pick one: > > 1. I want to emit a JOIN from User to Car and order by Car.model - don't use > eager loading, use query.join(): This one. > http://docs.sqlalchemy.org/en/rel_0_9/faq.ht

Re: [sqlalchemy] [missing feature] joined relationship + order by: table alias problem

2014-03-26 Thread Michael Bayer
On Mar 26, 2014, at 1:04 PM, Staszek wrote: > Hi > > I have a problem with joined relationships, which I will try to describe > using an example: > > >car = relationship("Car", lazy='joined', innerjoin=True) > > Querying for User now seems to generate SQL expressions like this: > > SELE

[sqlalchemy] [missing feature] joined relationship + order by: table alias problem

2014-03-26 Thread Staszek
Hi I have a problem with joined relationships, which I will try to describe using an example: class User(Base): __tablename__ = 'users' __table_args__ = ... id = Column(BigInteger, autoincrement=True, primary_key=True) ... carId = Column(BigInteger, ForeignKey('cars.id'))

Re: [sqlalchemy] Trying to map a big arbitrary query to a class

2014-03-26 Thread Michael Robellard
reread your example code, that will actually do the trick. On Wednesday, March 26, 2014 9:07:52 AM UTC-4, Michael Robellard wrote: > > I want it mapped to an object because I want to have some > properties/methods that can be executed on each row of the results that > will do some additional log

Re: [sqlalchemy] Trying to map a big arbitrary query to a class

2014-03-26 Thread Michael Robellard
I want it mapped to an object because I want to have some properties/methods that can be executed on each row of the results that will do some additional logic. On Tuesday, March 25, 2014 6:21:31 PM UTC-4, Michael Bayer wrote: > > > On Mar 25, 2014, at 2:43 PM, Michael Robellard > > > wrote: