[sqlalchemy] Re: Questions about polymorphic mappers

2007-01-12 Thread King Simon-NFHD78
Michael Bayer wrote: i think using the polymorphic_map is OK. i downplayed its existence since I felt it was confusing to people, which is also the reason i made the _polymorphic_map argument to mapper private; it was originally public. but it seemed like it was producing two ways of

[sqlalchemy] Re: left join with mappers ?

2007-01-12 Thread Julien Cigar
In fact what I want to be able to do is : select a.id, (select b.name from invasive_names b, languages c where b.invasive_id=a.id and b.language_id=c.id and c.iso_code='en') as name_en from invasives a order by foo; where mappers are : a = Invasive, b = InvasiveName, c = Language Julien

[sqlalchemy] Column aliases

2007-01-12 Thread Marco Mariani
Hi there This relates to Turbogears, but is really a SA question. I've customized TG authentication authorization to use my autloaded tables in Postgres and SqlAlchemy 0.3.3. In my schema, I have User.c.uid, the login name of the users, as a primary key TG uses a User mapper with two

[sqlalchemy] how to find out the last insert id ?

2007-01-12 Thread dischdennis
what is the easiest way to find out the last insert id? (MySQL 5) supplast = select([func.last_insert_id()],app_schema.SupplierTable.c.pr_supplier_ID 0).execute().fetchone()[0] does not work for some reason Dennis --~--~-~--~~~---~--~~ You received this

[sqlalchemy] Re: autoloading oracle tables and the owner parameter

2007-01-12 Thread Patrick Down
Thanks, I will give that a try. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to

[sqlalchemy] Re: How to query like sys_id=42 AND ts_created 90 minutes ago ?

2007-01-12 Thread Jonathan Ellis
You can shorten it a little by having the db do the date operation: History.c.ts_created func.now() - '90 minutes' On 1/11/07, Chris Shenton [EMAIL PROTECTED] wrote: I've got a bunch of history and other timestamped information I will need to query against. The columns are created with type

[sqlalchemy] Re: Column aliases

2007-01-12 Thread Michael Bayer
to have aliases of properties that are usable with get_by(), use the synonym function, described in: http://www.sqlalchemy.org/docs/adv_datamapping.myt#advdatamapping_properties_overriding --~--~-~--~~~---~--~~ You received this message because you are

[sqlalchemy] Re: left join with mappers ?

2007-01-12 Thread Michael Bayer
Julien Cigar wrote: In fact what I want to be able to do is : select a.id, (select b.name from invasive_names b, languages c where b.invasive_id=a.id and b.language_id=c.id and c.iso_code='en') as name_en from invasives a order by foo; where mappers are : a = Invasive, b = InvasiveName, c

[sqlalchemy] Re: Questions about polymorphic mappers

2007-01-12 Thread Michael Bayer
King Simon-NFHD78 wrote: class EmployeeMapperExtension(sa.MapperExtension): def create_instance(self, mapper, selectcontext, row, class_): cls = get_employee_class(row[employee_table.c.kind]) if class_ != cls: return

[sqlalchemy] Re: DynamicMetaData + create/drop table = confusion

2007-01-12 Thread Kumar McMillan
uggh, pysqlite 2.1 fixed some other problems I was having in transactions iirc. I'm scared to upgrade/downgrade :( On 1/11/07, Michael Bayer [EMAIL PROTECTED] wrote: the important thing is your sqlite version. im on 3.2.1. my pysqlite seems to be2.0.2 ? maybe a new pysqlite bug, not

[sqlalchemy] Re: DynamicMetaData + create/drop table = confusion

2007-01-12 Thread Kumar McMillan
oh, nice. upgrading sqlite to 3.3.7 and rebuilding pysqlite2 fixed it -- sorry for the noise. On 1/12/07, Kumar McMillan [EMAIL PROTECTED] wrote: uggh, pysqlite 2.1 fixed some other problems I was having in transactions iirc. I'm scared to upgrade/downgrade :( On 1/11/07, Michael Bayer

[sqlalchemy] Re: Mapping special child rows

2007-01-12 Thread Jonathan Ellis
Okay, I have another question related to this. Now that I have max_order defined, I want to do a query on it (give me the users whose max_order==5). My code is max_orders_by_user = select([func.max(orders.c.order_id).label('order_id')], group_by=[orders.c.user_id]).alias('max_orders_by_user')

[sqlalchemy] Re: Mapping special child rows

2007-01-12 Thread Michael Bayer
errr, the relations that mapper setup can feed into select_by would include all the attributes you have on Order, which does not include max_order_id. youve got two relations that both point to an Order relation, so select_by is more or less out at that point since it can only be given order_id,