On Jun 6, 2007, at 11:32 AM, Eric Ongerth wrote: > So, skis are working fine but skiboots aren't. If I either comment > out the 'size' column in the skiboots table: > # Column('size', types.Numeric(3,1)), > - or - comment out the 'skiboots' line in the item_join: > # 'skiboot':items.join(skiboots), > > ...then it runs ok. > > Maybe I'm making incorrect use of the Numeric type? Or is this a > bug? I want to use the Numeric type because i'd like to represent > boot sizes as, e.g., 9.5, 10.0, 10.5. For skis the size is a String > because sometimes it's a number and sometimes a nominal size like "s", > "m", "xl", etc. No problem with the string; i'm just wondering if I > can use the Numeric type as sqla currently stands. Do I have to > define a custom type and stash Numerics in string representations? > > Thanks! >
your "size" column differs in type. you cant create a UNION with differing types in the unioned queries. so it can either be both string, both numeric, or use distinct columns. its basically this: create table a (id integer primary key, size varchar(30)) create table b (id integer primary key, size integer) select id, size from a UNION ALL select id, size from b -> bzzt note that version 0.4 of SQLAlchemy, which you can play with right in its branch, has a new feature whereby polymorphic loading can be achieved without using UNION (it issues additional SELECT statements, so is not as efficient for large loads). --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---