Re: [sqlalchemy] further restricting a query provided as raw sql

2010-05-04 Thread Chris Withers
Michael Bayer wrote: Are the innards of in_ exposed anywhere for public consumption or should I avoid? from sqlalchemy.sql import column column(anything_you_want).in_(['a', 'b', 'c']) Thanks, that's exactly what I was looking for... Chris -- You received this message because you are

[sqlalchemy] filter by backref field

2010-05-04 Thread a...@vurve.com
Hi All, This might be a noob question, but I wasn't able to to find the answer combing through the docs and google search. Given the following declarations Base = declarative_base() class A(Base): __tablename__ = 'A' id = Column(Integer, primary_key=True) class B(Base):

Re: [sqlalchemy] filter by backref field

2010-05-04 Thread Conor
On 05/03/2010 10:33 PM, a...@vurve.com wrote: Hi All, This might be a noob question, but I wasn't able to to find the answer combing through the docs and google search. Given the following declarations Base = declarative_base() class A(Base): __tablename__ = 'A' id =

[sqlalchemy] Re: reflecting (autoload=True) MySQL tinyint(1) fields

2010-05-04 Thread Brad Wells
The docs for the MySQL dialect need to be updated to reflect this change. See http://www.sqlalchemy.org/docs/reference/dialects/mysql.html#sqlalchemy.dialects.mysql.TINYINT For what it's worth I'd really like to see this remain as an optional behavior. The BOOL/BOOLEN column types in MySQL are

Re: [sqlalchemy] session lifecycle and wsgi

2010-05-04 Thread Chris Withers
Michael Bayer wrote: (I'm guessing session.merge will whine if handed an object that is already in another session?) mm no merge() leaves the original unaffected. it copies state to an instance internal to the session. this is very clear here:

Re: [sqlalchemy] session lifecycle and wsgi

2010-05-04 Thread Michael Bayer
On May 4, 2010, at 1:59 PM, Chris Withers wrote: So putting non-expunged objects in something like a beaker cache would be a no-no, correct? (would .close() or .remove() fix the problem if the objects are already in the cache by the time the .close() or .remove() is called?) in most cases

Re: [sqlalchemy] Re: reflecting (autoload=True) MySQL tinyint(1) fields

2010-05-04 Thread Michael Bayer
On May 4, 2010, at 1:22 PM, Brad Wells wrote: The docs for the MySQL dialect need to be updated to reflect this change. See http://www.sqlalchemy.org/docs/reference/dialects/mysql.html#sqlalchemy.dialects.mysql.TINYINT For what it's worth I'd really like to see this remain as an optional

[sqlalchemy] disable RETURNING for specific primary key columns

2010-05-04 Thread Kent
I understand I can disable RETURNING for an engine with 'implicit_returning=False' Is there a way to do this for certain primary key columns only, but not disabled engine-wide? (We've done some flexible view creation so that our app (sqlalchemy) sees the same database metadata whether we are on

Re: [sqlalchemy] disable RETURNING for specific primary key columns

2010-05-04 Thread Michael Bayer
On May 4, 2010, at 2:30 PM, Kent wrote: I understand I can disable RETURNING for an engine with 'implicit_returning=False' Is there a way to do this for certain primary key columns only, but not disabled engine-wide? (We've done some flexible view creation so that our app (sqlalchemy)

Re: [sqlalchemy] disable RETURNING for specific primary key columns

2010-05-04 Thread Kent Bower
You think of everything? ;) Thanks On 5/4/2010 2:41 PM, Michael Bayer wrote: On May 4, 2010, at 2:30 PM, Kent wrote: I understand I can disable RETURNING for an engine with 'implicit_returning=False' Is there a way to do this for certain primary key columns only, but not disabled

Re: [sqlalchemy] disable RETURNING for specific primary key columns

2010-05-04 Thread Michael Bayer
we needed it foroh MS-SQL tables that have triggers. On May 4, 2010, at 3:11 PM, Kent Bower wrote: You think of everything? ;) Thanks On 5/4/2010 2:41 PM, Michael Bayer wrote: On May 4, 2010, at 2:30 PM, Kent wrote: I understand I can disable RETURNING for an engine with

[sqlalchemy] Re: reflecting (autoload=True) MySQL tinyint(1) fields

2010-05-04 Thread Brad Wells
0/1 generally works in Python but won't convert to formats with native boolean values correctly, in my case JSON. Just a note, your suggestion works for me but will fail for any unsigned columns. I have a working solution so I'm fine with moving on from the issue, Overall however, with MySQL's

[sqlalchemy] Best way to order by columns in relationships?

2010-05-04 Thread Timmy Chan
i have a few polymorphic tables, and i want to sort by a column in one of the relationship. i have tables a,b,c,d, with relationship a to b, b to c, c to d. a to b is one-to-many b to c and c to d are one-to-one, but polymorphic. given an item in table a, i will have a list of items b, c, d

[sqlalchemy] Get list of items to be flushed in session extension

2010-05-04 Thread chris e
I'm trying to provide functionality in a session extension for an class to provide a 'before_flush' method that allows the class to make changes to the session, and add additional items. To do this I need to get the list of instances to be flushed to the database, and the order in which

Re: [sqlalchemy] Get list of items to be flushed in session extension

2010-05-04 Thread Michael Bayer
On May 4, 2010, at 5:23 PM, chris e wrote: I'm trying to provide functionality in a session extension for an class to provide a 'before_flush' method that allows the class to make changes to the session, and add additional items. To do this I need to get the list of instances to be flushed

[sqlalchemy] Re: Get list of items to be flushed in session extension

2010-05-04 Thread chris e
I'll look into the new code. It does look simpler. I tried using the MapperExtension functionality, but, the last time I tried to use it, it did not allow for orm level changes(new items added to the session, or attribute changes) to be made, as the UOW has already been calculated. My main use

Re: [sqlalchemy] Re: Get list of items to be flushed in session extension

2010-05-04 Thread Michael Bayer
On May 4, 2010, at 7:42 PM, chris e wrote: I'll look into the new code. It does look simpler. I tried using the MapperExtension functionality, but, the last time I tried to use it, it did not allow for orm level changes(new items added to the session, or attribute changes) to be made, as the