[sqlalchemy] association obj/proxy

2007-04-05 Thread svilen
seems this is the month of the many2many relations ;-) why is a the whole assoc.proxy + _AssocList needed? Can't one do just with overloading/replaceing the InstrumentedList's append() ? or something of sorts. i know it might be messier, but with proper hooks it will be

[sqlalchemy] Re: simple many-to-many select

2007-04-05 Thread Ram Yalamanchili
was filter_by added recently? I have a assign_mapped class User from TG, and doing a session.query(User).filter_by doesn't work (no such method). On 4/4/07, Michael Bayer [EMAIL PROTECTED] wrote: My preference with assign_mapper at this point is to say: Client.query.filter_by(sites=siteobj)

[sqlalchemy] Re: association obj/proxy

2007-04-05 Thread svilen
here's what i did and it seems to work: class _Empty: pass class Base4Association(..):#the base for assoc_objects ... class MyCollection( list): factory = None def append( me, obj =_Empty, **kwargs): if obj is _Empty:#marker for notset; else just use

[sqlalchemy] Re: simple many-to-many select

2007-04-05 Thread Glauco
Ram Yalamanchili ha scritto: was filter_by added recently? I have a assign_mapped class User from TG, and doing a session.query(User).filter_by doesn't work (no such method). yes, it's in the latest 0.3.6 version... this sometime it's hopeful :-) - orm: - the full featureset of

[sqlalchemy] Re: How would you build a mapper with a calculated field based on a join from two tables

2007-04-05 Thread Glauco
vinjvinj ha scritto: Say I have a python class defined: def class User(object): get_calculated_field(self): return self.a_column_in_user_table_1 + self.a_column_in_additional_info user_table = Table('user_table', metadata, autoload=True) additional_info =

[sqlalchemy] Re: simple many-to-many select

2007-04-05 Thread Glauco
Glauco ha scritto: Ram Yalamanchili ha scritto: was filter_by added recently? I have a assign_mapped class User from TG, and doing a session.query(User).filter_by doesn't work (no such method). yes, it's in the latest 0.3.6 version... this sometime it's hopeful :-)

[sqlalchemy] Re: 0.3.6 problem, was working with 0.3.4

2007-04-05 Thread fw
Thanks Rick, I updated to the latest SVN rev and things do work now. Cheers, François On Apr 4, 10:08 pm, Rick Morrison [EMAIL PROTECTED] wrote: Hi fw, The explicit zero for the float column was a bug that should be fixed in rev #2491. MSSQL can store low-resolution datetimes in

[sqlalchemy]

2007-04-05 Thread meyyitfani
The Second Station of the Thirteenth Word In the Name of God, the Merciful, the Compassionate. [A conversation held with some young people who, though surrounded by temptation, had not yet lost their power of reason.] Being assaulted by the deceptive, seductive amusements of the present time,

[sqlalchemy] Re: 0.3.6 problem, was working with 0.3.4

2007-04-05 Thread fw
Hi Rick, I am afraid I reported success a bit too fast. The problem has changed though. I am using rev 2492. If I use the MakerCost mapper as it is defined in my previous email, I get a strange behaviour: If I query a MakerCost directly (e.g. session.query(MakerCost).select_by(..))

[sqlalchemy] Re: [sqlalchemy]

2007-04-05 Thread Rick Morrison
trans = session.create_transaction() messages.delete(messages.c.submitter_type == 'spammer').execute() bozodetector.insert().execute({'[EMAIL PROTECTED]'}) trans.commit() On 4/5/07, meyyitfani [EMAIL PROTECTED] wrote: *The Second Station of the Thirteenth Word*

[sqlalchemy] query for a subset of the object's columns

2007-04-05 Thread Disrupt07
I hava a table called mytable (defined in the model as mytable_def) with the following columns: name, surname, age, address, idcard, sex, mobilenumber I want to query its name and surname columns only, so I am using a query such as the following:

[sqlalchemy] Re: Is ILIKE supported?

2007-04-05 Thread Paul Kippes
Michael, I certainly understand why this hasn't been added. With some databases like sqlite, a case sensitive search isn't even possible. This is much more complicated that I would have imagined. --~--~-~--~~~---~--~~ You received this message because you are

[sqlalchemy] Re: How would you build a mapper with a calculated field based on a join from two tables

2007-04-05 Thread vinjvinj
a = user_table() a.a_column_in_user_table_1 + a.additional_info.your_column My logic is not as simple as (a.a_column_in_user_table_1 + a.additional_info.your_column). It's about 20 lines of code. Also I'm trying to understand how you would add additional attributes to a python User object

[sqlalchemy] Autoload and Foreign Keys

2007-04-05 Thread mike nelson
Could someone explain how I could do the following: #None of these tables have foreign keys defined in the database entity = Table('entity',meta,autoload=True) user = Table('user',meta,autoload=True) class Entity(object): pass class User(Entity): pass m_entity = mapper(Entity,entity)

[sqlalchemy] Re: simple many-to-many select

2007-04-05 Thread Alexandre CONRAD
Michael Bayer wrote: My preference with assign_mapper at this point is to say: Client.query.filter_by(sites=siteobj) For the mailing list's archives correctness: Client.query().filter_by(sites=siteobj) i.e. i dont think constantly adding methods to assignmapper is going to scale,

[sqlalchemy] Re: offset limit on query with relations

2007-04-05 Thread King Simon-NFHD78
Huy wrote: Hi, When using the generative limit() offset() or order_by calls on mapper query, the sql generated looks weird. I get something like select table1.* table2.* from (select table1a.id from table1a limit 20 offset 0 order by table1.col) as table_row, table1 join

[sqlalchemy] Re: offset limit on query with relations

2007-04-05 Thread HD Mail
King Simon-NFHD78 wrote: Huy wrote: Hi, When using the generative limit() offset() or order_by calls on mapper query, the sql generated looks weird. I get something like select table1.* table2.* from (select table1a.id from table1a limit 20 offset 0 order by table1.col) as

[sqlalchemy] Re: Autoload and Foreign Keys

2007-04-05 Thread Michael Bayer
explicitly specify the columns: entity = Table('entity', meta, Column('somecol', ForeginKey('user.id')) autoload=True ) On Apr 5, 2007, at 10:46 AM, mike nelson wrote: Could someone explain how I could do the following: #None of these tables have foreign keys defined in the

[sqlalchemy] Re: offset limit on query with relations

2007-04-05 Thread Michael Bayer
On Apr 5, 2007, at 6:27 PM, HD Mail wrote: King Simon-NFHD78 wrote: Huy wrote: Hi, When using the generative limit() offset() or order_by calls on mapper query, the sql generated looks weird. I get something like select table1.* table2.* from (select table1a.id from table1a limit

[sqlalchemy] FlushError (unsaved, pending instance and is an orphan)

2007-04-05 Thread George Sakkis
I'm using SA (with Elixir on top) and I have a parent Entity Ranker that has many children Results; that is, for a Ranker instance rk, rk.results gives its children and for a Result rs, rs.ranker gives its parent. When I add new children by providing the parent to the constructor of the child