PonyORM: generators as a query syntax

Michael Torrie torriem at gmail.com
Thu Dec 8 12:22:58 EST 2016


On 12/08/2016 07:26 AM, Alex Kaye wrote:
> Can you describe some uses or example for using ORM for a Newbie ?

Simply put, ORM is a method for making objects that represent records in
a database.  It's usually done in such a way that the objects are
"live."  In other words if the object has an attribute representing a
column in a table, if I assign to that, it will update the database
automatically. As well ORM abstracts and encapsulates relations between
database tables.  So if two tables are related, if you delete an object
from the first table, it will automatically ask the database to delete
dependent, related records from the related table.

https://en.wikipedia.org/wiki/Object-relational_mapping

Some people think ORM is pointless and would rather just work directly
with the databases using purpose query languages like SQL.  One reason
Django and other web frameworks use ORM is that it abstracts the
specifics of the database engine so you can more easily switch from
sqlite to mysql to posgresql or even use a commercial database engine.
There has always been a lively debate over ORM.  At some point the
abstraction will leak and you'll get some database-specific problem you
have to deal with in your app code.

For PonyORM examples, see the pony orm web pages:
https://docs.ponyorm.com/firststeps.html
https://docs.ponyorm.com/queries.html

Currently I'm planning to use it in a non-web application.  I messed
with it a bit last night and it works pretty well for what I need to use
it for, which is pretty simple on the database end.




More information about the Python-list mailing list