[orm-devel] Re: Postgres & Views

Diedrich Vorberg diedrich@tux4web.de
Thu, 21 Nov 2002 14:46:30 +0100


Hi Mike,

>result = ds.query("select * from v_sessions") certainly is a viable option 
>for me and maybe for all users. Its not as nice as having a handy object 
>however. Getting spoiled already.

Check out the datasource.runSelect(dbclass, query) method. It will 
run any query you supply and construct instances of dbclass from the 
result. Just make sure all the columns you need are there.

Note that with postgres, that will give you dbobjects, that have 
oid = None even though they are stored within the database already.

This might solve the problems with views, too, though without 
representing them as Python objects and classes properly.

Diedrich

-- 
           _..._                            Diedrich Vorberg
         .'     '.
        /  _   _  \                         http://www.tux4web.de
        | (o)_(o) |                         info@tux4web.de
         \(     ) /            .---.
         //'._.'\ \           /     \       Internet Dienstleistungen
        //   .   \ \          \.@-@./       und 'Consulting'.
       ||   .     \ \         /`\_/`\
       |\   :     / |        //  _  \\      Linux Rules!
       \ `) '   (`  /_      | \     )|_
     _)``".____,.'"` (_    /`\_`>  <_/ \
     )     )'--'(     (    \__/'---'\__/
      '---`      `---`