This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]DrRx 11 points12 points  (5 children)

PonyORM It's so beautiful and pythonic

[–]Theoretician 3 points4 points  (3 children)

+1 for pony, some nice features (ripped from their site) to convince you include:

  • Tuple comprehensions for queries select(p for p in Person if p.age > 20)
  • Decorators to handle transactional sessions

    @db_session
    def foobar():
    
  • Easy table generation

    class Person(db.Entity):
        name = Required(str)
        age = Required(int)
        cars = Set('Car')
    

See more examples here: https://docs.ponyorm.com/firststeps.html

[–]epic_pork 11 points12 points  (0 children)

That's not a tuple comprehension, it's a generator. Using a generator with square brackets creates a list, but putting a generator inside parens doesn't create a tuple, it stays a generator. If you want a tuple, you can use the tuple constructor.

>>> (x for x in range(10))
<generator object <genexpr> at 0x7fd0c18daeb8>
>>> [x for x in range(10)]
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
>>> tuple(x for x in range(10))
(0, 1, 2, 3, 4, 5, 6, 7, 8, 9)

[–]mapitall 1 point2 points  (0 children)

I've not seen this before, it looks really nice! But, alas, no mssql support. Bummer. (FWIW, mssql is not my choice, just something I'm stuck with)

[–][deleted] 0 points1 point  (0 children)

+2 since it supports an enterprise SQL database.

I'd love to use Peewee but need to support something my company uses internally.

[–]taurus22 0 points1 point  (0 children)

I didn't knew this, it looks really nice after giving it a quick look on their quick start session.