[web2py] Re: Accesing table from external database

2014-09-21 Thread Leonel Câmara
I would use requires IS_IN_SET(db(db.personal_personal.id>0)._select(db.personal_personal.nombre)) and set it in the controller so you don't calculate the set of names every time the table is loaded. If it's ok for the list of names to not be completely up to date all the time I would cache it.

[web2py] Re: Accesing table from external database

2014-09-20 Thread José Eloy
Thanks for all answers. I put an example about I want to do: In db.py I define 2 databases: db= DAL('mssql://SQL SERVER DATABASE') #db is a SQL Server database doesn't created with web2py db2 = DAL('mssql://SQL SERVER DATABASE') #db2 is a SQL Server database created with web2py #Below are so

[web2py] Re: Accesing table from external database

2014-09-19 Thread Brian M
José, Just because the database was not created by web2py does not automatically mean that you cannot access it through the DAL. As long as the table you want to get at has an auto-increment integer primary key field you can define that table through the DAL - even if the identity field is not

[web2py] Re: Accesing table from external database

2014-09-19 Thread José Eloy
Thanks Brian and Carlos for the answer and sorry for my delay. "external database" means it's a database not created by Web2py. The matter is I'd like to reference a web2py table with another table from the "external database". I know that this is not possible, but what could be the best way to

[web2py] Re: Accesing table from external database

2014-09-17 Thread Brian M
What do you mean by "external database"? Are you actually meaning a legacy database that the DAL didn't create itself? You can certainly connect web2py to such a database through the DAL or even just using db.executesql(). If you need to get a list of valid options for your combobox you can do