Re: providing arguements to queries

Timothy Smith <timothy-/[email protected]> Tue, 30 Nov 2004 07:19:29 +1000
Newsgroups gmane.comp.python.db.pypgsql.user
Message-ID <[email protected]>
I've already solved this, but.

sql gives you so many abilities, why should you be limited to providing 
aruguement to a single clause? it really is very limiting.
theres no way to provide a variable list of arguements to your query.

Chuck Bearden wrote:

>On Sun, 28 Nov 2004 10:42:12 +0100, Karsten Hilbert
><[email protected]> wrote:
>[...]
>  
>
>>The query arguments are intended to be values for the *where*
>>clause, no ?
>>    
>>
>
>I am inclined to agree with Karsten that query arguments are for the
>WHERE clause.  To insert the names of columns to be retrieved into a
>SELECT statement at runtime, I would use Python string formatting and
>a helper function that returns a tuple of days of the week:
>
>def daysOfWeek():
>    <build list 'L' with range of days>
>    return tuple(L)
>[...]
>cur.excute("Select %s from table" % (daysOfWeek()))
>
>Chuck
>
>
>-------------------------------------------------------
>SF email is sponsored by - The IT Product Guide
>Read honest & candid reviews on hundreds of IT Products from real users.
>Discover which products truly live up to the hype. Start reading now. 
>http://productguide.itmanagersjournal.com/
>_______________________________________________
>Pypgsql-users mailing list
>[email protected]
>https://lists.sourceforge.net/lists/listinfo/pypgsql-users
>
>
>  
>



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. 
http://productguide.itmanagersjournal.com/