[sqlalchemy] NOT IN in orm queries

2008-09-02 Thread Artur Siekielski
Hi. How can I use ...WHERE sth NOT IN (1, 4 ,5) queries when using ORM quering? There is '_in' only and I don't see how can I pass negation to it. I tried to use general 'op' but I get these errors: Session.query(Region).filter(Region.id.op('NOT IN')( [1,2,3] )).all() ProgrammingError:

[sqlalchemy] Re: NOT IN in orm queries

2008-09-02 Thread Artur Siekielski
Oh thanks... I thought that negation works for sql-expression queries only. Maybe some info should be added to ORM documentation? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this

[sqlalchemy] Re: Copy of a table with a different name

2008-07-17 Thread Artur Siekielski
send along a test case that includes whatever ForeignKey references to/ from ObjectType might be involved here.    My initial guess might be   to lose the constraints.copy() section since each Column.copy() will   contain a copied ForeignKey inside of it.  copy() has only been used   by the

[sqlalchemy] Copy of a table with a different name

2008-06-12 Thread Artur Siekielski
Hi. I want to have two Table definitions in one MetaData which are the same except the name of the second one has SND_ prefix. To avoid duplication of schema definition I looked at Table.tometadata() source and created the following function: def _cloneToSND(table, metadata): return

[sqlalchemy] Re: Performance problem with Psyco

2008-06-11 Thread Artur Siekielski
On Jun 11, 11:53 am, [EMAIL PROTECTED] wrote: if u replace back the offending function with its plain pythonic variant, will it work? Which function do you mean? 50% boost... just because of the python? u're constructing too many queries over and over. No, the main module in which we have

[sqlalchemy] Performance problem with Psyco

2008-06-10 Thread Artur Siekielski
Hi. I'm using Python 2.5.1 + SQLAlchemy + Psyco 1.6 for accelerating Python computations. Everything works ok for SQLAchemy 0.4.4 (50% performance boost), but for SQLAlchemy 0.4.5, 0.4.6 and latest SVN version (0_4 branch) there is a huge slowdown and profiling shows that SA's code takes much

[sqlalchemy] Re: Performance problem with Psyco

2008-06-10 Thread Artur Siekielski
On Jun 10, 8:11 pm, Michael Bayer [EMAIL PROTECTED] wrote: I would first take a look at the SQL   being issued as the first source of speed differences;  if in 0.4.5   there's suddenly a whole series of deletes occuring which do not   within 0.4.4, then that's the source of the difference.

[sqlalchemy] LIKE doesn't work in direct SQL queries

2008-05-14 Thread Artur Siekielski
Hi. I want to execute ready SQL query using SA's engine: engine.execute(r''' SELECT * FROM City WHERE name LIKE 'a%' ''') I get this strange error: /usr/share/python2.5/site-packages/SQLAlchemy-0.4.6dev_r4720-py2.5.egg/ sqlalchemy/engine/default.py in do_execute(self, cursor, statement,

[sqlalchemy] Re: LIKE doesn't work in direct SQL queries

2008-05-14 Thread Artur Siekielski
It works :). Ah, I was sure I have tried it :). Thanks for fast reply. On 14 Maj, 18:42, Michael Bayer [EMAIL PROTECTED] wrote: try two percent signs to escape it - %%. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google

[sqlalchemy] Re: Yielding all instances

2008-01-03 Thread Artur Siekielski
On Jan 3, 12:13 am, Michael Bayer [EMAIL PROTECTED] wrote: better yet, try out the trunk r3993, the patch I attached has a few quirks in it. Thanks for great support, this is what I wanted. --~--~-~--~~~---~--~~ You received this message because you are

[sqlalchemy] Yielding all instances

2008-01-02 Thread Artur Siekielski
Hi. I have a table with many records (about 1mln), mapping is straightforward - one DB record corresponds to one Python object of the mapped class. I have to do something with every record. Code like this doesn't work: for inst in session.query(Bar): foo(inst) because all instances are loaded

[sqlalchemy] Re: From arbitrary SELECT to Query

2007-12-09 Thread Artur Siekielski
But is Query object constructed by from_statement fully functional? Using filter doesn't work for me - it returns the same query. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this

[sqlalchemy] Re: From arbitrary SELECT to Query

2007-12-09 Thread Artur Siekielski
no, from_statement replaces all filtering. Shouldn't it throw some exception then? so, what is it youre trying to do exactly ? I'm writing DAO module for db access which must be independent of rest of the system. I'm looking for a class which can be used as a proxy for SQL results. Query

[sqlalchemy] From arbitrary SELECT to Query

2007-12-07 Thread Artur Siekielski
I have a compound SELECT statement (of class CompoundSelect) that is composed of a few normal SELECTs combined by UNION. from_obj of this SELECT contains all columns of a table that is mapped to a class. I would like to get objects created using defined mapper, but selected using my compound

[sqlalchemy] UNION of Query objects

2007-12-06 Thread Artur Siekielski
Hi. I know that I can do SQL UNION of two record sets when using SQL Expression objects. But how to do UNION of two sqlalchemy.orm.Query objects? I can do the UNION on SQL Expressions level and then use 'from_statement' from Query, but what I can do if I already have two Queries?

[sqlalchemy] Re: UNION of Query objects

2007-12-06 Thread Artur Siekielski
Hi. I know that I can do SQL UNION of two record sets when using SQL Expression objects. But how to do UNION of two sqlalchemy.orm.Query objects? I can do the UNION on SQL Expressions level and then use 'from_statement' from Query, but what I can do if I already have two Queries?