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ézin
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'
whi
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 "
Yes!!
That what I thought... I had already db.table.field.type in mind, but
didn't know how to invoque adapter...
Thanks Anthony.
Richard
On Fri, Feb 6, 2015 at 7:55 AM, Anthony wrote:
> And if you want the actual Postgres field type for a given field, you can
> do:
>
> db._adapter.types[db.t
And if you want the actual Postgres field type for a given field, you can
do:
db._adapter.types[db.tablename.fieldname.type]
However, you will get back values that include Python string formatting
syntax, such as:
VARCHAR(%(length)s)
Anthony
On Friday, February 6, 2015 at 4:55:31 AM UTC-5,
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)
Hello,
I am in the process of refactoring model definition and merging multiple
table into one table with multiple columns (denormalisation) and I would
like to extract programmatically the time of each of the multiple tables
fields...
Thanks
Richard
--
Resources:
- http://web2py.com
- http
Hello,
I would clarify my understanding a bit... In the book it says :
Notice that requires=... is enforced at the level of forms, required=True is
enforced at the level of the DAL (insert), while notnull, unique and
ondeleteare enforced at the level of the database. While they sometimes may
seem
8 matches
Mail list logo