in ARRAY[12, 14, 15, 20]

Giles Velarde <[email protected]>
Newsgroups gmane.comp.python.db.psycopg.devel
Message-ID <[email protected]>
Hi All,

I have come accross an odd situation where I am trying to pass pass an  
array of IDs into a query:

since = "2009-06-01"
ids = [12, 14, 15, 20]

query = """
SELECT count(*), organism_id
FROM feature
WHERE timelastmodified > %s
AND organism_id
IN %s
GROUP BY organism_id;
"""

rows = self.cur.execute(query, (since, ids) )

I get back :

Traceback (most recent call last):
   File "test/unit_tests.py", line 102, in testCountAllOrganisms
     result =  
self.whats_new.countAllChangedFeaturesForOrganisms(since, organismIDs)
   File "/home/gv1/code/genlib/python/charpy/business/api.py", line  
78, in countAllChangedFeaturesForOrganisms
     rows = self.cur.execute(query, (since, ids) )
ProgrammingError: syntax error at or near "ARRAY"
LINE 6:         in ARRAY[12, 14, 15, 20]
                    ^

I have searched the mailing lists unsuccessfully. Any help with how to  
properly pass these parameters into this query would be greatly  
appreciated.

Thanks,
Giles



-- 
 The Wellcome Trust Sanger Institute is operated by Genome Research 
 Limited, a charity registered in England with number 1021457 and a 
 company registered in England with number 2742969, whose registered 
 office is 215 Euston Road, London, NW1 2BE.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.