[sqlalchemy] Formatting return of 'query'

2009-06-08 Thread Harish Vishwanath
Hello, Can a query be written to return required columns along with some delimiter? Example : #User is a class, it has firstname, lastname, age, password q = session.query(User.firstname,User.lastname,User.age,User.password).all() #this would return [(fname,lname,22,pwd),] How can I

[sqlalchemy] Query.delete() issues a select before delete?

2009-06-01 Thread Harish Vishwanath
Hello All, I found this : #s is a session object #Director is a class s.query(Director).filter(Director.name == 'Dir30').delete() 2009-06-01 16:17:00,750 INFO sqlalchemy.engine.base.Engine.0x...9a10 SELECT director.id AS director_id FROM director WHERE director.name = ? 2009-06-01 16:17:00,796

[sqlalchemy] Re: Query.delete() doesn't cascade on Sqlite

2009-06-01 Thread Harish Vishwanath
group of deletes The disadvantage of this approach is that you lose the ability to rollback the entire delete process, and now must handle that problem with application design. -- Mike Conley On Fri, May 29, 2009 at 4:08 AM, Harish Vishwanath

[sqlalchemy] Query.delete() doesn't cascade on Sqlite

2009-05-29 Thread Harish Vishwanath
Hello, I am running Sqlite/SQLA/Elixir on an embedded system. I have different classes with OneToMany relationships and I have configured cascade = all, delete, delete-orphan correctly on them. However, for this to work, I should do something like : parentlist = session.query(Parent).all() for

[sqlalchemy] Re: Questions on SQLA Queries

2009-05-27 Thread Harish Vishwanath
for one or more then one query params. On May 26, 9:10 pm, Harish Vishwanath harish.shas...@gmail.com wrote: Hello, Question 1: When there is a query like below : q = session.query(User.name) #(User is a class) and when I do q.all(), a list of tuples (User.name,) is returned though

[sqlalchemy] Questions on SQLA Queries

2009-05-26 Thread Harish Vishwanath
Hello, Question 1: When there is a query like below : q = session.query(User.name) #(User is a class) and when I do q.all(), a list of tuples (User.name,) is returned though a single column is asked for. Is there a way to get a list directly from q.all() when a single column is required?

[sqlalchemy] Re: SQLAlchemy 0.5 Released

2009-01-08 Thread Harish Vishwanath
Congratulations! And many thanks for the wonderful SQLA! Cheers. On Wed, Jan 7, 2009 at 1:12 AM, Michael Bayer mike...@zzzcomputing.comwrote: Hello list - I am pleased to announce the release of SQLAlchemy 0.5.0, the first official release in the 0.5 series. This series has been in the

[sqlalchemy] Fastest Way of removing an object from session.identity_map

2008-12-18 Thread Harish Vishwanath
Hello, I have a scenario like below : - Session has weak_identity_map set to true. Therefore session is self pruning. - In some situations, the session might contain object references, which have been deleted by other sessions from the database. - In such cases, I want to remove the references of

[sqlalchemy] Problem in working with two sessions to the same database.

2008-12-14 Thread Harish Vishwanath
Hello All, I have a situation like this : Thread T1, has session T1Session. Thread T2, has session T2Session. They both bind to the same database. Now, I have scenario like below : u1 = User() u2 = User() u3 = User()#All these are Entity objects, , and are primary

[sqlalchemy] Invalid Request Error at session level.

2008-11-27 Thread Harish Vishwanath
Hello, I am using SQLA 0.5rc2 on Py 2.5.2 with Elixir 0.6. I have a multithreaded application, and each thread gets a separate session object. All of them use the same disk based database. I get the below exception : Exception in thread RSIHostDBSync: Traceback (most recent call last): File

[sqlalchemy] Re: Trouble with Strings getting converted to Unicode types

2008-11-25 Thread Harish Vishwanath
:47 PM, Harish Vishwanath wrote: Hello, Thanks for your reply. Please see the below implementation : *Implementation 1:* def my_con_func(): ... print My Connection func ... import sqlite3.dbapi2 as sqlite ... con = sqlite.connect(:memory:) ... con.text_factory=str

[sqlalchemy] Re: Trouble with Strings getting converted to Unicode types

2008-11-23 Thread Harish Vishwanath
: pysqlite always returns Python unicode objects and this is outside of the realm of SQLAlchemy. I'm not familiar with a pysqlite option to change this but you should consult their site for any options related to it. Harish Vishwanath wrote: Hello All, I am using Elixir 0.6.1 over SQLA 0.5rc2

[sqlalchemy] Trouble with Strings getting converted to Unicode types

2008-11-18 Thread Harish Vishwanath
Hello All, I am using Elixir 0.6.1 over SQLA 0.5rc2. Consider the below : from elixir import * class A(Entity): *... name = Field(String(40))* ... class B(A): *... address = Field(String(40))* ... engine = sqlite:///c:\\temp\\2.sqlite metadata.bind = engine setup_all(True) a =