Andrew Dalke wrote:
> It sounds like you're saying that the interface is actually implemented
> by passing the execute string and a database-specific dictionary-like
> object; the latter created by the DB-API interface.
That's the way it's supposed to work. The program prepares a statement
with p
Daniel Dittmar wrote:
> Possible workarounds:
...
> - create a class for this purpose. Statement are created on the fly, but
> with placeholders so you don't run into the SQL Injection problem. As
> it's an object, you could cache these generated statements base on the
> size of the list
> It
Andrew Dalke wrote:
> I want to execute a query with an "IN" in the WHERE clause
> and with the parameter taken from a Python variable. That
> is, I wanted something like this to work
>
> id_list = ["AB001", "AB002", "AB003"]
>
> c.execute("""SELECT s.smiles FROM smiles_database s WHERE """
>
Andrew Dalke wrote:
> Steve Holden wrote:
>
>>Do you think this is a DB-API 3-ish kind of a thing, or would it layer
>>over DB-API 2 in a relatively platform-independent manner?
>
> ...
>
>>but-you-may-know-better-ly y'rs - steve
>
>
> I am a tyro at this. I had to find some tutorials
Steve Holden wrote:
> Do you think this is a DB-API 3-ish kind of a thing, or would it layer
> over DB-API 2 in a relatively platform-independent manner?
...
> but-you-may-know-better-ly y'rs - steve
I am a tyro at this. I had to find some tutorials on SQL
to learn there even was an IN cla
Andrew Dalke wrote:
> infidel wrote:
>
>>I think perhaps you are asking for something that the OCI doesn't
>>provide.
>
>
> But it doesn't need to be supported by the OCI.
>
>
>>And really, it all boils down to the list comprehension:
>>
>>in_clause = ', '.join([':id%d' % x for x in xrange(len
infidel wrote:
> I think perhaps you are asking for something that the OCI doesn't
> provide.
But it doesn't need to be supported by the OCI.
> And really, it all boils down to the list comprehension:
>
> in_clause = ', '.join([':id%d' % x for x in xrange(len(ids))])
And why can't the equivalen
I think perhaps you are asking for something that the OCI doesn't
provide. At least I'd be rather surprised if it did. I know that the
SQL syntax doesn't provide for such a mechanism.
And really, it all boils down to the list comprehension:
in_clause = ', '.join([':id%d' % x for x in xrange(len
infidel wrote:
> Something like this might work for you:
>
ids= ['D102', 'D103', 'D107', 'D108']
in_clause = ', '.join([':id%d' % x for x in xrange(len(ids))])
sql = "select * from tablename where id in (%s)" % in_clause
import cx_Oracle as ora
con = ora.connect('foo/[EMA
Something like this might work for you:
>>> ids= ['D102', 'D103', 'D107', 'D108']
>>> in_clause = ', '.join([':id%d' % x for x in xrange(len(ids))])
>>> sql = "select * from tablename where id in (%s)" % in_clause
>>> import cx_Oracle as ora
>>> con = ora.connect('foo/[EMAIL PROTECTED]')
>>> cur =
A while back I asked about which Oracle client to use for
MS Windows. Turns out I also needed one for unix so I followed
people's advice and installed cx_Oracle.
I want to execute a query with an "IN" in the WHERE clause
and with the parameter taken from a Python variable. That
is, I wanted some
11 matches
Mail list logo