In DAL it can be done like one single command:
db.define_table('my_items',
Field('name', 'string', length=100),
Field('description', 'string', length=400),
Field('priority', 'integer'),
Field('creator_id', 'reference user'),
Field('dept_id', 'reference department'),
)
Persistence layer, being a common pattern, is already included with a sane
implementation, in the true spirit of python.
You can find the gory details (cascade, unique, not null and so on) in the
web2py book.
2014-12-24 20:08 GMT+01:00 Alan Evangelista <[email protected]>:
>
>
> On Tuesday, December 23, 2014 1:16:52 PM UTC-2, Alan Evangelista wrote:
>>
>>
>> It might be easier if you provide a concrete example of what you are
>>> trying to achieve (perhaps using the syntax of an existing ORM or using
>>> pseudo-code) and explain how the DAL falls short.
>>>
>>
>> Using SQLAlchemy as data mapper below.
>>
>>
> Just noticed there are some small flaws in the implementation code I
> posted (eg some variables names in object and mapper do not match) because
> I cut and paste and adapted this, sorry. Anyway, I think it is quite
> possible to now understand what I meant before.
>
> --
> 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.