Re: [sqlalchemy] Custom SQL construct for postgres multirow insert

2012-11-28 Thread Michael Bayer
On Nov 28, 2012, at 7:18 AM, Idan Kamara wrote: > > That works, thanks. > > In the example you provided you invoked the compiler with the > a Table like so: compiler.process(element.table, asfrom=True). > > Is there a way to do something similar with the columns/values so it generates > the st

Re: [sqlalchemy] Custom SQL construct for postgres multirow insert

2012-11-28 Thread Idan Kamara
On Tue, Nov 27, 2012 at 6:18 PM, Ryan Kelly wrote: > > On Tue, Nov 27, 2012 at 11:00:25AM -0500, Michael Bayer wrote: > > > > On Nov 27, 2012, at 8:10 AM, Idan Kamara wrote: > > > > > Hello, > > > > > > I'd like to create a construct for postgres's multirow insert. I asked > > > this on IRC > > >

Re: [sqlalchemy] Custom SQL construct for postgres multirow insert

2012-11-28 Thread Idan Kamara
On Tue, Nov 27, 2012 at 6:00 PM, Michael Bayer wrote: > > On Nov 27, 2012, at 8:10 AM, Idan Kamara wrote: > >> Hello, >> >> I'd like to create a construct for postgres's multirow insert. I asked this on IRC >> and got some great help from supplicant, however I have a few things missing: >> >> - pr

Re: [sqlalchemy] Custom SQL construct for postgres multirow insert

2012-11-27 Thread Michael Bayer
On Nov 27, 2012, at 11:18 AM, Ryan Kelly wrote: >> >> an insert with many values() I'd not be bypassing psycopg2's usual bound >> parameter mechanisms and I'd be using a naming scheme, such as: >> >> INSERT INTO table (a, b, c) VALUES (%(a1)s, %(b1)s, %(c1)s), (%(a2)s, >> %(b2)s, %(c2)s), ...

Re: [sqlalchemy] Custom SQL construct for postgres multirow insert

2012-11-27 Thread Ryan Kelly
On Tue, Nov 27, 2012 at 11:00:25AM -0500, Michael Bayer wrote: > > On Nov 27, 2012, at 8:10 AM, Idan Kamara wrote: > > > Hello, > > > > I'd like to create a construct for postgres's multirow insert. I asked this > > on IRC > > and got some great help from supplicant, however I have a few things

Re: [sqlalchemy] Custom SQL construct for postgres multirow insert

2012-11-27 Thread Michael Bayer
On Nov 27, 2012, at 8:10 AM, Idan Kamara wrote: > Hello, > > I'd like to create a construct for postgres's multirow insert. I asked this > on IRC > and got some great help from supplicant, however I have a few things missing: > > - proper conversion of Python types to SQL (None to null). > - h

[sqlalchemy] Custom SQL construct for postgres multirow insert

2012-11-27 Thread Idan Kamara
Hello, I'd like to create a construct for postgres's multirow insert. I asked this on IRC and got some great help from supplicant, however I have a few things missing: - proper conversion of Python types to SQL (None to null). - handle binding of values like the rest of SQLAlchemy This is the

[sqlalchemy] custom sql.

2007-01-31 Thread Brent Pedersen
hi, how can put custom sql in a query? specifically in this code? the problem is with the order_by. i want to pass it some custom sql: q = session.query(Student) sajoin = q.join_to('address') return q.select( sajoin, order_by="(ABS(address.lat - %s