DB versus SQLAchemy, or what's the real advantage of using sqlachemy

50 views
Skip to first unread message

Leandro Severino

unread,
Jan 22, 2013, 7:17:10 AM1/22/13
to we...@googlegroups.com
Friends,

   Looking in the cookbook, exits a sample code with the SQLAlchemy (http://webpy.org/cookbook/sqlalchemy).

   What's the real advantage of using sqlachemy instead of db module ?

   Today, I'm organizing my codes in this way:
   
   code.py ->         Start point to my apps.
   controller.py ->  Here, I call the specifics render methods.
   render.py ->      Here, I have the memcached logic to get my objects from memory(cache) or get from model.py
   model.py ->       Here, I have the db.select(), db.insert() and etc.
   forms.py  ->       Forms used in my apps.

-- Leandro
   

Alexander Meesters

unread,
Feb 18, 2013, 9:28:40 AM2/18/13
to we...@googlegroups.com
Well, the db module is "just" a query builder, it allows for a quicker and/or more logic construct of the query, allowing Rapid development.

A ORM does what it say it does: Object-relational Mapper, it maps classes to databases tables and columns, and in this case, even allows for the creation of the scheme itself.

Thats all i know about ORM's cause i think they are nothing but a hype. Plus the fact that it require a lot of workflow changes in order to allow that. I always build the db scheme, then the application. 
A ORM allows you to make up the design of the database "as you go", and more dangerous, "As you see fit", which would mean you need to keep a keen eye out for database pollution and data integrity. cause everybody knows that what seems logic in code, isnt logic for the database scheme, and having a ORM decide that for you would be insane.

But maybe i am just a dinosaur.
(feel free to correct me if i'm wrong)

Op dinsdag 22 januari 2013 13:17:10 UTC+1 schreef Leandro Severino het volgende:
Reply all
Reply to author
Forward
0 new messages