[sqlalchemy] delete multiple objects

2009-02-20 Thread Ids
Hello, I'm using the declarative extension and was wondering (after searching the docs) how to elegantly delete multiple objects at once, preferably without loading them in first. Suppose you've got a mapped class like this: class Person(Base): __tablename__ = 'persons' stamp =

[sqlalchemy] Re: delete multiple objects

2009-02-20 Thread Mike Conley
query has both bulk delete and update methods http://www.sqlalchemy.org/docs/05/reference/orm/query.html#the-query-object count = session.query(Person).filter(... whatever criteria ...).delete(synchronize_session=False) On Fri, Feb 20, 2009 at 5:22 AM, Ids idsvandermo...@gmail.com wrote:

[sqlalchemy] Re: SQLAlchemy and scrollable cursors

2009-02-20 Thread Frank Millman
On Feb 19, 7:23 pm, Rick Morrison rickmorri...@gmail.com wrote: Unfortunately, AFAICT, MS-SQL does not have an OFFSET clause (it uses TOP instead of LIMIT). How does SQLA handle this situation? For mssql2005 and higher, (those versions of mssql that support window functions using OVER,  

[sqlalchemy] Re: SQLAlchemy and scrollable cursors

2009-02-20 Thread Michael Bayer
On Feb 19, 2009, at 12:23 PM, Rick Morrison wrote: For this to work in SA 0.4 and 0.5, you'll need to add the engine keyword has_window_funcs=1 to your connection string. From what I understand, SA 0.6+ will sniff out the mssql version and automatically toggle the behavior. well, in

[sqlalchemy] Is there a way to get a list of bindparam() names from a pre-constructed select clause?

2009-02-20 Thread Bo
I have a select clause containing a subselect that may or may not have a bindparam... I haven't been able to dig up a way to get the list of bindparams in said clause. Is there a way to do this? --~--~-~--~~~---~--~~ You received this message because you are

[sqlalchemy] Re: puzzling setup with ForeignKey - SOLVED

2009-02-20 Thread Alessandro Dentella
On Thu, Feb 19, 2009 at 12:57:07PM +0100, Alessandro Dentella wrote: Hi, in a working setup I added a ForeignKey to table 'cliente_cliente' as follows (client_id): class Project(Base): __tablename__ = ticket_project __table_args__ = {'useexisting' : True} id =

[sqlalchemy] connectionless queries with Spatial data (PostGIS)

2009-02-20 Thread quaker4lyf
Hello, I need to query, insert, update and delete from already existing PostGIS tables. After much trial and error, nothing worked. Then I came across this message: http://groups.google.com/group/sqlalchemy/msg/424d9aa10d30abaf Following that, I've confirmed that the following works: f =

[sqlalchemy] Re: connectionless queries with Spatial data (PostGIS)

2009-02-20 Thread Michael Bayer
the func. call is a SQL expression which can't be bound to a bind parameter. that has to stay in the values() clause. e.g. table.insert().values(location=f, id=97).execute(), or table.insert().values(location=f).execute(id=97). if you wanted everything inside of 'f'