On Thu, May 21, 2009 at 8:43 AM, Elcimar <elci...@gmail.com> wrote:

>
> Hello. I am a total newbie on web2py. I am starting a project of a web
> application which controls Freeradius's authentication server (user
> database being MySQL). Freeradius ships with an SQL file to generate
> all tables it needs. What should I do?


First, create a test setup!

>
>
> * Recreate all Freeradius table structures into db.py by hand?
> * Find a way to convert the SQL file to web2py? wwwsqldesigner (with
> patches) saves in web2py format, but only when I design something,
> never when importing an SQL/XML.


First, some concepts:


   - To access a table, you only need to tell web2py about the data you
   intend to access; entire table definitions are NOT necessary;
   - TOUGH RESTRICTION:  With web2py DAL, each table must have an
   autoincrement primary key which is an integer AND CALLED "id";    The most
   likely scenario is that there are primary keys with some other name, in
   which case you will need to figure out how - on your database server - to
   create simple views which will remap the primary key to a field named "id"
   - In web2py, you will want to define the table with migrate=False (so
   that web2py doesn't issue any "ALTER TABLE..." instruction, for instance if
   you accidentally make a typo on a  field name)

Right now there is not automatic table reflection mechanism in web2py, so
you will need to create the table DAL table descriptions for the fields you
want to access.

Start with a test - create some entries (by hand if needed) in your target
MySQL db, and try to read and write the values you care about in web2py.
For example, start with just "id" and "name" fields  of a more extensive
table.

Hope this is helpful.

Regards,
- Yarko

>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to