object-relational mappers

Luis M. González luismgz at gmail.com
Thu Apr 3 11:28:15 EDT 2008


Yes, webpy's db api can be used in stand-alone scripts if you want.
See below:

import web
db = web.database(dbn='mysql', db='northwind', user='root')
x = db.select('employees')
...

Another good thing is that, since queries return Storage objects
(similar to dictionaries), they are much more flexible.
Suppose that you get the results of a form sent via a POST method, and
you want to insert this data into your database.
You would simple write:

i = web.input()
db.insert('orders', **i)

So everything related to CRUD operations are is easy to do, without
having to mess with objects.
I think this sticks strictly to the KISS principle, keeping it simple,
with less overhead, less layers of abstraction and therefore, less
bugs and complications.
And it matchs perfectly webpy's philosofy for creating web apps.

Luis


On 3 abr, 11:06, Bruno Desthuilliers <bruno.
42.desthuilli... at websiteburo.invalid> wrote:
> Seems nice too in another way. Is that part independant of the rest of
> the framework ? If so, I'll have to give it a try at least for admin
> scripts.




More information about the Python-list mailing list