[sqlalchemy] Calling a PostgreSQL function taking %ROWTYPE

2014-09-08 Thread Tyler Bondy
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

Re: [sqlalchemy] Calling a PostgreSQL function taking %ROWTYPE

2014-09-08 Thread Tyler Bondy
Hmm, I've tried that and gotten the following error: ProgrammingError: (ProgrammingError) function discounted_price(unknown) is not unique LINE 1: SELECT discounted_price('packages.*') AS discounted_price_1 ^ HINT: Could not choose a best candidate function. You might need to

Re: [sqlalchemy] Calling a PostgreSQL function taking %ROWTYPE

2014-09-08 Thread Tyler Bondy
(‘packages.*’)) won’t quote like that: from sqlalchemy import func, text print func.discounted_price(text('packages.*')) discounted_price(packages.*) On Sep 8, 2014, at 12:10 PM, Tyler Bondy ty.b...@gmail.com javascript: wrote: Hmm, I've tried that and gotten the following error

[sqlalchemy] relationship issues

2014-06-12 Thread tyler
I can't seem to construct a relationship against this ServiceInstance class without having the Endpoint class inherit from a new declarative_base(). I've tried several different methods of calling relationship() and the error messages are fairly similar. Below I've shown the two classes as

Re: [sqlalchemy] relationship issues

2014-06-12 Thread tyler
I have tried calling relationship without foreign_keys or primaryjoin, in which case I get an error message suggesting I specify foreign_keys. Base is the same class for both model classes in the case where this does not work. When each model class has a different Base class things work fine.

Re: [sqlalchemy] relationship issues

2014-06-12 Thread tyler
Also, thanks for the quick reply. -- 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 sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to

Re: [sqlalchemy] relationship issues

2014-06-12 Thread tyler
Thanks, I ran a similar script without any problems. It seems there's a modification somewhere to the Base we are using that causes the conflict. On Thursday, June 12, 2014 12:26:45 PM UTC-4, Simon King wrote: For what it's worth, the following script works for me, but I only have access to

[sqlalchemy] modeling a has-a relationship

2012-08-27 Thread Littlefield, Tyler
Hello all: I'm looking at how to model this setup. I have objects in a game, that are called entities. Each entity has a list of components, which inherit the component class. A living component might have attributes like hp, max_hp, etc along with the component properties. So: I'm trying to