That second typed aproach works, the other one would cough up on trying to
initialize BindParamClause.

Quoting Michael Bayer <[EMAIL PROTECTED]>:

>
> havent tried either of these, but you could try jacking up BindParamClause:
>
> class CallableBind(sql.BindParamClause):
>     def __init__(self, callable, name):
>         super(CallableBind, self).__init__(name, None)
>         self.callable = callable
>     value = property(lambda s:s.callable())
>
> s = foo.select(foo.c.bar == CallableBind(somecallable, 'val'))
>
> that should run the callable not exactly on each execute but on each
> compilation.
>
> or maybe you could do it via types:
>
> class CallableType(types.String):
>     def __init__(self, callable):
>         self.callable = callable
>     def convert_bind_param(self, value, e):
>         return self.callable()
>
> s = foo.select(foo.c.bar == bindparam('val', None,
> type=CallableType(somecallable))
>
> just some ideas.
>
> Florian Boesch wrote:
> > can I construct a select which gets the value it selects against from a
> > callable
> > each time it is executed?
> >
> > i.e.
> >
> > foo.select(foo.c.bar == fun(somecallable))
> >
> > cheers,
> > Florian
> >
> >
> > -------------------------------------------------------
> > This SF.Net email is sponsored by xPML, a groundbreaking scripting
> > language
> > that extends applications into web and mobile media. Attend the live
> > webcast
> > and join the prime developer group breaking into this new coding
> > territory!
> > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
> > _______________________________________________
> > Sqlalchemy-users mailing list
> > Sqlalchemy-users@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users
> >
>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by xPML, a groundbreaking scripting language
> that extends applications into web and mobile media. Attend the live webcast
> and join the prime developer group breaking into this new coding territory!
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
> _______________________________________________
> Sqlalchemy-users mailing list
> Sqlalchemy-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users
>
>




-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Sqlalchemy-users mailing list
Sqlalchemy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users

Reply via email to