Great! ---  You are on your way now!  Have lot's of fun!

"id" is so common (which is why Massimo included it as default) --- but some
hand-designed DB apps will name this with something else for readability.

Regards,
- Yarko

On Thu, May 21, 2009 at 1:55 PM, Elcimar L. Santos <[email protected]>wrote:

>
> It worked!
>
> Not so hard as I thought. Just took some fields as example as you said (I
> think I am not going to use all of them anyway). I added this within my main
> model:
>
> rd = SQLDB('mysql://user:passw...@localhost/radius')
> rd.define_table("radcheck",
>     SQLField("username", "string", length = 64, notnull = True),
>     SQLField("value", "string", length = 253, notnull = True), migrate =
> False)
>
> My luck Freeradius's schema has the "id" field you mentioned. Now I can
> figure out the rest. What was I afraid of :D
>
> Atenciosamente,
>
> Elcimar Leandro - http://elcimar.blogspot.com
> Portal Net Fácil  - http://www.nfacil.com.br
>
>
> 2009/5/21 Yarko Tymciurak <[email protected]>
>
>> On Thu, May 21, 2009 at 8:43 AM, Elcimar <[email protected]> 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 [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