Werner F. Bruhin wrote:
>
> Figured out how to run the called procedure.
>
> sql = db.sa.text("select trans_value from t(:totrans, :username)",
>                     bindparams=[db.sa.bindparam('totrans', 'some text
> orig'),
>                                 db.sa.bindparam('username', me.name)])
> result = session.execute(sql).fetchone()
> print result
> (u'some text orig auf Deutsch',)
>
>
> But still stuck on how to make this an additional column using
> declarative base and obtaining "some text orig" from another column in
> the same table.
>
> Is this at all possible?

easiest would be a plain python method that calls the appropriate SQL. 
alternatively, if you really want to use a mapped column, the only
advantage is the inline SQL aspect of it, i.e. performance.  you'd
construct a select() from the above and pass the dependent columns in -
using the third example in
http://www.sqlalchemy.org/docs/05/sqlexpression.html#functions , something
like

select([column('x1')]).select_from(func.t(mytable.c.totrans,
mytable.c.username))

then map it using column_property().


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to