[orm-devel] No such attribute or function 'oid'

Eric Walstad orm-devel@mailman.tux4web.de
Sun, 12 Jan 2003 22:43:12 -0800


Diedrich,
I guess that I can't work with PostgreSQL views as orm objects because 
views don't have oid's(?).  It seems orm is reliant on oid (at least for 
PostgreSQL).  It might be nice to be able to specify the primary key in 
when creating the dbclass subclass and having it us the pk instead of 
the oid.  Just a thought.

Best regards,

Eric.

-- 
_________________________

Eric Walstad
222 Winfield Street
San Francisco, CA 94110
415-643-0812 voice & fax
eric@ericwalstad.com
_________________________




funds = self.ds.selectByClauses(funding_summary, where="fsid = %d" % 
self.invoice.id).fetchall()

============================================================
SELECT funding_summary.oid, 
funding_summary.time_start,funding_summary.name,funding_summary.funding_limit,funding_summary.days_remain,funding_summary.time_end,funding_summary.fsid,funding_summary.amt_remain 
FROM funding_summary WHERE fsid = 318
============================================================
Traceback (most recent call last):
   File "ewwork.py", line 514, in OnLinkToFundingSources
     funds = self.ds.selectByClauses(funding_summary, where="fsid = %d" 
% self.invoice.id).fetchall()
   File "/usr/lib/python2.2/site-packages/orm/datasource.py", line 302, 
in selectByClauses
     return self.runSelect(dbclass, query)
   File 
"/usr/lib/python2.2/site-packages/orm/adapters/pgsql/datasource.py", 
line 286, in runSelect
     return orm.datasource.datasource_base.runSelect(self, dbclass, query)
   File "/usr/lib/python2.2/site-packages/orm/datasource.py", line 331, 
in runSelect
     cursor = self.execute(query)
   File 
"/usr/lib/python2.2/site-packages/orm/adapters/pgsql/datasource.py", 
line 376, in execute
     cursor.execute(query)
psycopg.ProgrammingError: ERROR:  No such attribute or function 'oid'

Eric Walstad wrote:
> Diedrich,
> I forgot to mention that I have a PostgreSQL view with an "interval" 
> data type:
>                  View "funding_summary"
>     Column     |            Type             | Modifiers
> ---------------+-----------------------------+-----------
>  fsid          | integer                     |
> ...
>  days_remain   | interval                    |
> 
> Notice that days_remain is of type interval, which when rendered looks 
> like:
> SELECT days_remain FROM funding_summary LIMIT 1;
>  days_remain
> -------------
>  213 days
> (1 row)
> 
> I'm just starting to play around with this view, but I'm assuming that I 
> should have a dbclass definition like this:
> # Views
> class funding_summary(dbclass):
>     columns = {"fsid"           :integer(),
>                ...
>                "days_remain"    :varchar()}
> 
> That is, that the "interval" type should be a "varchar" orm column.  Is 
> it reasonable to request you add an alias for interval types?
> 
> Thanks,
> 
> Eric.