On Sep 8, 2008, at 5:12 PM, Diez B. Roggisch wrote:
> > Michael Bayer schrieb: >> >> On Sep 8, 2008, at 3:56 PM, Diez B. Roggisch wrote: >> >>> This does fail with the same error - the :: isn't properly >>> recognized. I >>> tried to escape as you said: >>> >>> select([literal_column(r"count(*)\:\:float")], >>> and_(at.c.question_id == >>> qt.c.id)).as_scalar() >> >> can't reproduce. Here's a test case tested against the current 0.4 >> and 0.5 trunks: >> >> from sqlalchemy import * >> >> engine = create_engine('postgres://scott:[EMAIL PROTECTED]/test', >> echo=True) >> >> foo = Table("foo", MetaData(engine), Column('data', String(50))) >> foo.create(checkfirst=True) >> >> engine >> .execute >> (select([literal_column("count(*)::float")]).select_from(foo)) >> >> output: >> > > I identified the culprit - it's sqlite. My unittests run against > sqlite > - and thus the postgres type-cast can't possibly work... Sorry for the > noise. > > On thing I'd still like to know: is there a way to give the quotient > of > the two selects a name, instead of anon_*? > yeah.... (select(x).as_scalar() / select(y).as_scalar).label('mylabel') --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---