you just do

db=SQLDB(....)
db.define_table('tablename',
    SQLField('fieldname','string'),
    ...
    migrate=False)

You only need to (re)define those tables and those fields that you
need to access and exist already (migrate=False).
The field type "string" has to match the field as it exists: "string",
"text", "boolean", "double", "integer", ... etc.

It is critical that the table you access has a primary key auto-
increment field called "id". This field should not be listed in the
define_table above because web2py always assumes it. If you do not
have such field you may need to create a view for the table. There are
threads about that.

Hope it helps.

Massimo

On May 8, 10:30 am, visuallinux <[email protected]> wrote:
> Hello Alvaro,
>
> Thanks for your answer.
>
> > today web2py does not retrieve information from database tables
> > automaticaly. You have to use define_table() (with migrate=False) for
> > all tables that you want to work with.
>
> Do you could explain the use of the function define_table () or any
> example for working with an data base Postgres existing.
>
> Best regards,
>
> Fernando
>
> On 8 mayo, 00:52, Álvaro Justen [Turicas] <[email protected]>
> wrote:
>
> > On Fri, May 8, 2009 at 1:32 AM, visuallinux <[email protected]> wrote:
> > > Hello All,
>
> > > I am new in we2py, my question is the folliwing:
>
> > > How i can mapping or working with an data base Postgres existing?
>
> > > I hope look your comments.
>
> > Hi Fernando,
> > today web2py does not retrieve information from database tables
> > automaticaly. You have to use define_table() (with migrate=False) for
> > all tables that you want to work with.
>
> > I have plans to create a db.discover_tables() but it requires more
> > work. I want to function discover tables automaticaly, to use in
> > databases that weren't created by web2py.
>
> > --
> >  Álvaro Justen
> >  Peta5 - Telecomunicações e Software Livre
> >  21 3021-6001 / 9898-0141
> >  http://www.peta5.com.br/
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to