I work around that by just print string of db.table.field.type and write my
model in web2py then generate SQL with an SQL generator app...

:)

This will be all right, I am not writing SQL that much anymore, I let
web2py generate it form me :)

Richard

On Fri, Feb 6, 2015 at 9:23 AM, Richard Vézina <[email protected]>
wrote:

> Hoho!
>
> As you mention Anthony, db._adapter.types[] doesn't provide the direct
> backend type... You get the type but not the extend of the domain of the
> field... Also, notice that in case of web2py decimal db.table.field.type
> will be 'decimal(4, 2)' and the key in _adapter.types is only 'decimal'
> which return as mention python dict formatting string...
>
> Richard
>
> On Fri, Feb 6, 2015 at 9:14 AM, Richard Vézina <
> [email protected]> wrote:
>
>> Hello Leonel,
>>
>> Actually my tables names are prefixed with old postgres schema name so, I
>> can easily filter the one of interest... Also, the IDs fields don't matter,
>> since the are prefixed with table name like so "tablename_id"...
>>
>> I also change some fields names that are common in many table like
>> "result" into tablename_result for instance...
>>
>> Then I get an map field name dictionnary that I can use to create new
>> single table field name and import and update everything that need update...
>>
>> The only missing piece was how to programmatically generate the DDL of
>> the new table that will contain over 200 fields and at least just get the
>> field type  it is very easy to insert this into table creation DDL then.
>>
>> :)
>>
>> Thanks
>>
>> Richard
>>
>> On Fri, Feb 6, 2015 at 4:55 AM, Leonel Câmara <[email protected]>
>> wrote:
>>
>>> Do you want a list of all field types? This would do it:
>>>
>>> field_types = []
>>> for table in db.tables:
>>>     for field in db[table].fields:
>>>         field_types.append(db[table][field].type)
>>>
>>>
>>> However you will have a lot of ids.
>>>
>>> --
>>> Resources:
>>> - 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 [email protected].
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>

-- 
Resources:
- 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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to