I agree.
Here is a more concrete explanation.
Given the following tables:
db.define_table('Continent', Field('Name', 'string'))
db.define_table('Country', Field('Name', 'string'), Field('Continent',
db.Continent))
db.define_table('City', Field('Name', 'string'), Field('Country', db.Country
))
Using an ORM, you could do something like:
>>> Country(Name='France').City.list
[<City Name:Paris>, <City Name:Nice>]
Using the DAL, the best you might get is:
>>> [city for city in db.City.Country.select() if city.Country.Name ==
''France']
[<Row Name:Paris>, <Row Name:Nice>]
In an ORM on-top of the DAL, I would like to be able to do something like:
@ORM(db.City)
class City:
pass
@ORM(db.Country)
class Country:
pass
@ORM(db.Continent)
class Continent:
pass
>>> europe = Continent(Name='Europe')
>>> france = Country(Name='France', Continent=europe)
>>> paris = City(Name='Paris', Country=france)
>>> nice = City(Name='Nice', Country=france)
>>>
>>> europe.Country(Name='France') is france
True
>>> france.City(Name='Paris') is paris
True
>>> europe.Country(Name='France').City.list
[<City Name:Paris>, <City Name:Nice>]
>>> paris.Country is france
True
>>> france.Continent is europe
True
This would be so intuitive and easy to use...
--
---
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/groups/opt_out.