Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

PonyORM: generators as a query syntax

26 views
Skip to first unread message

Michael Torrie

unread,
Dec 7, 2016, 9:06:17 PM12/7/16
to
I was just made aware of a very interesting ORM project that has been
around since about 2013, while listening to a recent episode of the Talk
Python To Me podcast. The idea of using generators to build queries is
really cool. I'm sure PonyORM has its limitations and drawbacks, as all
ORM models do. But I like what see so far, particularly how simple it
is from a programmer's point of view. Thought others may not have heard
of it either, but would find it interesting:

https://ponyorm.com/

Anyone have any real-world experience with it vs some other ORM like
SQAlchemy? I have a small database project that I may use PonyORM with
so we'll see how it goes. I have not yet determined which versions of
Python it works with. Hopefully it supports Python 3.

I have no idea what kind of black magic is used under the hood to build
the SQL queries.

Michael Torrie

unread,
Dec 8, 2016, 12:23:15 PM12/8/16
to
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.


0 new messages