Revision 3494
Added by Aaron Marcuse-Kubitza over 12 years ago
sql.py | ||
---|---|---|
656 | 656 |
distinct_on_all = object() # tells mk_select() to SELECT DISTINCT ON all columns |
657 | 657 |
|
658 | 658 |
def mk_select(db, tables=None, fields=None, conds=None, distinct_on=[], |
659 |
limit=None, start=None, order_by=order_by_pkey, default_table=None): |
|
659 |
limit=None, start=None, order_by=order_by_pkey, default_table=None, |
|
660 |
explain=True): |
|
660 | 661 |
''' |
661 | 662 |
@param tables The single table to select from, or a list of tables to join |
662 | 663 |
together, with tables after the first being sql_gen.Join objects |
... | ... | |
734 | 735 |
if start != None: |
735 | 736 |
if start != 0: query += '\nOFFSET '+str(start) |
736 | 737 |
|
737 |
query = with_explain_comment(db, query) |
|
738 |
if explain: query = with_explain_comment(db, query)
|
|
738 | 739 |
|
739 | 740 |
return query |
740 | 741 |
|
Also available in: Unified diff
sql.py: mk_select(): Added explain param to turn off automatically running EXPLAIN on the created query. This is useful for SELECT statements which use local variables in PL/pgSQL functions.