I use PG views quite often. Common problem is related to permissions: don't 
forget to grant privilege to web2py login role for select/reference from/to 
your handmade views. 
To define view I use db.base_table.field.clone()  - undocumented function
For example:
#definition base table
define_table('person', Field('name', represent=..., requires=..., required=
True, ...  ) )

#definition of view or just another table
   db.person.name.clone(name = 'seller_name'), # so, 
 db.sale_vw.seller_name  inherits all attrs (represent and so on ) from 
   db.person.name.clone(name = 'buyer_name'), 


On Wednesday, October 12, 2016 at 4:54:41 AM UTC+3, Jamie Courtes wrote:
> Hi All,
> I'm working with a colleague who is in the process of learning web2py.
> In parallel, I have developed a relatively simplistic database in 
> PostGreSQL, with approximately a dozen tables.
> We've managed to get the database into web2py, and can view each of the 
> tables (and their data) in the web interface.
> The problem comes when trying to get data from my master view which I 
> created within the database, which joins various fields from the many 
> tables.
> The view works fine in pgadmin/sqlmanager, and it's simple enough that I 
> am 100% confident in my view code, but it gives me errors in the web2py 
> console when trying to view the results of the view:
> Before I post any error messages, I wanted some guidance on the 'right' 
> way to do this. Should I be using views with web2py? Should the same 
> functionality a view provides, be created in the web2py code rather than a 
> database view?
> Looking for the best way to do this, since I am unsure if using a database 
> view is even the correct way...
> Thanks for your time!
> Jamie

- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to