put text() in there:
func.discounted_price(text("packages.*"))
On Sep 8, 2014, at 9:59 AM, Tyler Bondy <[email protected]> wrote:
> I have a PostgreSQL function discounted_price(packages%ROWTYPE), where
> packages is a table. I would like to add a property on the model
> corresponding
> to the packages table which returns the result of the discounted_price
> function.
>
> Currently I have this which works:
>
> @property
> def discounted_price(self):
> return connection.execute('select discounted_price(packages.*) from
> packages '
> 'where package_id=' +
> str(self.package_id)).first()
>
> But I'd like to call the function with sqlalchemy.sql.func, I'm just unsure
> of how to
> pass the packages%ROWTYPE corresponding to the model instance. Something
> like this:
>
> @property
> def discounted_price(self):
> return connection.query(func.discounted_price(**I don't know what goes
> here**))
>
> Is it possible to do this?
>
> --
> You received this message because you are subscribed to the Google Groups
> "sqlalchemy" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/sqlalchemy.
> For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.