[sqlalchemy] Re: LIMIT the number of children in relationship dynamically

2017-05-02 Thread Isaac Martin
Yep, I ended up doing exactly what you describe. Thanks again! > > -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http://www.sqlalchemy.org/ To post example code, please provide an MCVE: Minimal, Complete, and Verifiable Example. See http://stackoverflow.com/help/mcve f

Re: [sqlalchemy] Re: LIMIT function behavior

2010-01-21 Thread Michael Bayer
Kent wrote: > Unfortunately, in the case I noticed this happen, the join needs to be > applied first since the filter's where clause and the order by both > depend on the joined tables. Don't think your solution is helpful in > that case, but informative nonetheless. > > I can imagine a DISTINCT h

[sqlalchemy] Re: LIMIT function behavior

2010-01-21 Thread Kent
Unfortunately, in the case I noticed this happen, the join needs to be applied first since the filter's where clause and the order by both depend on the joined tables. Don't think your solution is helpful in that case, but informative nonetheless. I can imagine a DISTINCT helping (I am using orac

[sqlalchemy] Re: limit

2009-05-05 Thread Tiago Becker
Sorry for the mess, but now i have another problem ;-) s = select(columns=' * ', from_obj=' pessoa ', limit=1) or s = select(columns=' * ', from_obj=' pessoa ').limit(1) results in SELECT , * FROM pessoa LIMIT 1 but limit 1 is not valid in oracle... is it a sqlalchemy error? Or it shouldn

[sqlalchemy] Re: limit

2009-05-05 Thread Tiago Becker
Damn, my mistake, sorry, didn't see the [ ] :-) On Tue, May 5, 2009 at 3:15 PM, Tiago Becker wrote: > Thnx for the quick reply! :-) > > I dont think i got it.. > > the output of: > > s = select('select * from table ').offset(1).limit(1) > > is... > > SELECT s, e, l, c, t, , *, f, r, o, m, a, b

[sqlalchemy] Re: limit

2009-05-05 Thread Tiago Becker
Thnx for the quick reply! :-) I dont think i got it.. the output of: s = select('select * from table ').offset(1).limit(1) is... SELECT s, e, l, c, t, , *, f, r, o, m, a, b LIMIT 1 OFFSET 1 ... Can you please explain what am i doing wrong? Thnx a lot! On Tue, May 5, 2009 at 2:55 PM, Mich

[sqlalchemy] Re: limit

2009-05-05 Thread Michael Bayer
see http://www.sqlalchemy.org/docs/05/sqlexpression.html#ordering-grouping-limiting-offset-ing . Tiago Becker wrote: > Hello. > > I'm trying to write some kind of framework web, but i would like to use > sqlalchemy, but i need to make a paged result, and every DB has a way to > limit the query.

[sqlalchemy] Re: Limit invalidates query results on view - 0.4.8

2009-03-17 Thread Michael Bayer
try setting echo='debug'. it usually tells all. if any columns in the primary key are NULL, the query won't return an object. If you have partially null primary keys, set allow_null_pks=True on your mapper. On Mar 17, 2009, at 8:08 PM, Jonathan Vanasco wrote: > > I have query on a vi

[sqlalchemy] Re: limit the set of returned columns

2008-10-07 Thread Martijn Moeling
#x27;t know what yu're >> lokking for. >> >> The column specification increases my performance a lot >> >> Martijn Moeling >> >> -Oorspronkelijk bericht- >> Van: sqlalchemy@googlegroups.com [mailto:[EMAIL PROTECTED] >> Namens Empt

[sqlalchemy] Re: limit the set of returned columns

2008-10-07 Thread Michael Bayer
what yu're > lokking for. > > The column specification increases my performance a lot > > Martijn Moeling > > -Oorspronkelijk bericht- > Van: sqlalchemy@googlegroups.com [mailto:[EMAIL PROTECTED] > Namens Empty > Verzonden: Tuesday, October 07, 2008 3:18 PM

[sqlalchemy] Re: limit the set of returned columns

2008-10-07 Thread Martijn Moeling
The column specification increases my performance a lot Martijn Moeling -Oorspronkelijk bericht- Van: sqlalchemy@googlegroups.com [mailto:[EMAIL PROTECTED] Namens Empty Verzonden: Tuesday, October 07, 2008 3:18 PM Aan: sqlalchemy@googlegroups.com Onderwerp: [sqlalchemy] Re: limit the set of return

[sqlalchemy] Re: limit the set of returned columns

2008-10-07 Thread Empty
Hi, > Yesterday I was searching this group and the SA 5.0 doc to get something > working. Somewere I came across an option to specify the columnames to > return You can specify the column names as part of the query, like session.query(User.name, User.phone). > Filename, permissions

[sqlalchemy] Re: Limit to 500 records after particular date.

2008-09-24 Thread Michael Bayer
On Sep 24, 2008, at 11:02 AM, Heston James wrote: > > Hi, > > Thanks for the response, that gave me a good foot in the door to this. > I've now appened my existing query with. > > .order_by('myobject.created')[:1000] > > Which appears to give the desired result set, however, when looking > throu

[sqlalchemy] Re: Limit to 500 records after particular date.

2008-09-24 Thread Werner F. Bruhin
Heston, Heston James wrote: > Werner, > > Thank you for your response, very kind of you. This looks to be more > what I'm looking for, after a quick test it seems that it is now > applying the limit at the SQL level which is definitly a good thing. > > Where abouts in the documentation did you fi

[sqlalchemy] Re: Limit to 500 records after particular date.

2008-09-24 Thread Heston James
Werner, Thank you for your response, very kind of you. This looks to be more what I'm looking for, after a quick test it seems that it is now applying the limit at the SQL level which is definitly a good thing. Where abouts in the documentation did you find that? Look here: http://www.sqlalchemy

[sqlalchemy] Re: Limit to 500 records after particular date.

2008-09-24 Thread Werner F. Bruhin
Heston, Heston James wrote: > Hi, > > Thanks for the response, that gave me a good foot in the door to this. > I've now appened my existing query with. > > .order_by('myobject.created')[:1000] > Just tried this on a simple example: query = query.limit(500) Quote from doc for 0.5rc1: *def l

[sqlalchemy] Re: Limit to 500 records after particular date.

2008-09-24 Thread Heston James
Hi, Thanks for the response, that gave me a good foot in the door to this. I've now appened my existing query with. .order_by('myobject.created')[:1000] Which appears to give the desired result set, however, when looking through the SQL debug output it seems that the limit their is applied usin

[sqlalchemy] Re: Limit to 500 records after particular date.

2008-09-24 Thread az
first u get your query sorted in proper order (by timestamp or even dbid, or hierarchicaly via subselect + groupby + order, whatever) then yourquery[:1000] On Wednesday 24 September 2008 14:11:24 Heston James - Cold Beans wrote: > Morning Guys, > > > > I hope this'll be a fairly simple questi

[sqlalchemy] Re: LIMIT in queries

2007-12-14 Thread Michael Bayer
On Dec 14, 2007, at 5:22 PM, Mike Orr wrote: > > On Dec 14, 2007 1:31 PM, Felix Schwarz <[EMAIL PROTECTED]> wrote: >> Mike Orr wrote: >>> Are >>> there that many of those, given that I don't think [N] is even >>> documented? >> >> It is in the official documentation: >> >> http://www.sqlalchemy.

[sqlalchemy] Re: LIMIT in queries

2007-12-14 Thread Mike Orr
On Dec 14, 2007 1:31 PM, Felix Schwarz <[EMAIL PROTECTED]> wrote: > Mike Orr wrote: > > Are > > there that many of those, given that I don't think [N] is even > > documented? > > It is in the official documentation: > > http://www.sqlalchemy.org/docs/04/ormtutorial.html#datamapping_querying OK.

[sqlalchemy] Re: LIMIT in queries

2007-12-14 Thread Felix Schwarz
Mike Orr wrote: Are there that many of those, given that I don't think [N] is even documented? It is in the official documentation: http://www.sqlalchemy.org/docs/04/ormtutorial.html#datamapping_querying fs smime.p7s Description: S/MIME Cryptographic Signature

[sqlalchemy] Re: LIMIT in queries

2007-12-14 Thread Mike Orr
On Dec 12, 2007 6:20 AM, King Simon-NFHD78 <[EMAIL PROTECTED]> wrote: > > Felix Schwarz wrote: > > Hi, > > > > after reading the docs [1] I thought that something like > > session.query(User).filter(User.c.id > 3)[0] > > should work even if the filter clause does not return any rows. > > > > But -

[sqlalchemy] Re: LIMIT in queries

2007-12-14 Thread Felix Schwarz
Chris M wrote: Or you could use .limit(1). I've always found that more clear than the Python indexing notation because I think of it slicing a list, not applying a limit to a query. Thank you very much for your help. I already found limit before my posting but it did not work, because I used

[sqlalchemy] Re: LIMIT in queries

2007-12-12 Thread Chris M
Or you could use .limit(1). I've always found that more clear than the Python indexing notation because I think of it slicing a list, not applying a limit to a query. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "s

[sqlalchemy] Re: LIMIT in queries

2007-12-12 Thread King Simon-NFHD78
Felix Schwarz wrote: > Hi, > > after reading the docs [1] I thought that something like > session.query(User).filter(User.c.id > 3)[0] > should work even if the filter clause does not return any rows. > > But - compliant with Python's behavior - SQLAlchemy raises an > IndexError. > (...) >Fi

[sqlalchemy] Re: LIMIT in update()

2007-10-16 Thread jason kirtland
Rick Morrison wrote: >> On 10/16/07, *Jim Musil* <[EMAIL PROTECTED]> wrote: >> Hi, >> >> I'm trying to determine a way to append a LIMIT to an update() >> object. >> >> Is the solution a correlated update on the same table with the LIMIT >> on the select() object? > > Yes

[sqlalchemy] Re: LIMIT in update()

2007-10-16 Thread Rick Morrison
Yes, that would be the only thing that has a hope of working across database engines. LIMIT with UPDATE is MySQL-only AFAIK. For SA, joins in updates can be tricky, so the correlated query would best be a IN() or EXISTS() query that has the limit you want. To get a deterministic set of records tha

[sqlalchemy] Re: limit=bindparam("result_limit")

2007-10-03 Thread Michael Bayer
ive added ticket # 805 for the LIMIT/OFFSET bind parameter feature. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe

[sqlalchemy] Re: limit=bindparam("result_limit")

2007-10-01 Thread Michael Bayer
On Oct 1, 2007, at 8:35 PM, dykang wrote: > > I am trying to cut down on time the db spends compiling statements. > Using bind params > allows the query to look the same to the db, thus allowing it to not > parse it again. It's the > same use case that makes people want to use bind params anywhe

[sqlalchemy] Re: limit=bindparam("result_limit")

2007-10-01 Thread dykang
I am trying to cut down on time the db spends compiling statements. Using bind params allows the query to look the same to the db, thus allowing it to not parse it again. It's the same use case that makes people want to use bind params anywhere. Am I missing something here? I'm a relative newbie t

[sqlalchemy] Re: limit=bindparam("result_limit")

2007-09-22 Thread Michael Bayer
"limit" is not really portable to all databases; in some cases (particularly Oracle) SQLAlchemy has to use some completely different syntaxes to come up with LIMIT. Additionally, the purpose of a bind parameter is to represent data that is compared against or inserted into a column expressi

[sqlalchemy] Re: LIMIT syntax in old versions of MySQL

2007-09-20 Thread jason kirtland
King Simon-NFHD78 wrote: > Hi, > > The ancient version of MySQL that I am connecting to (3.23.58) doesn't > support the syntax 'LIMIT OFFSET ' syntax. Instead, it > uses LIMIT , . This is described in the docs, but it > doesn't say what version introduced the more standard syntax: > > http://de