Re: [Modeling-users] ec.fetch and SQL "in"
Status: Abandoned
Brought to you by:
sbigaret
From: Sebastien B. <sbi...@us...> - 2003-07-08 09:10:13
|
Yannick Gingras <yan...@sa...> wrote: > Hi,=20 > Is there a way to make a fetch the same way you do with the SQL "in" ? > ex: "status in [1, 2, 5, 23]" Not currently... > It is not that hard to make something like :=20 >=20=20=20 > qryLines =3D [] > for status in statuses: > qryLines.append("( status =3D=3D %d)" % status) > qry =3D " OR ".join(qryLines) Right. > but it look like a hack to me and is probably really inefficient for > large lists since spark and the DBMS will have quite a ugly string to > parse. Right again ;) I've submitted patch #767625 which makes it possible to do: objects=3Dec.fetch('Writer', 'age in [24, 82]') or: objects=3Dec.fetch('Writer', 'age not in [24, 82]')=20 Please test and report (I've only done partial testing, on integers only); if it's okay, I'll probably integrate it into the next release. Note: this patch also relaxes the constraint for operators AND, OR and NOT to be upper-case: w/ this patch they can be lower-cased as well (and, or, not). What do you think, all? Should we adopt this as well? (In this case, I guess we'll need to do the same for 'like'/'LIKE' and 'ilike'/'ILIKE') Regards, -- S=E9bastien. |