3 ms·
My favourite orm is Peewee for python. I really like how clean it is. grandma = Person.get(Person.name == 'Grandma L.') or query = Pet.select().where(Pet.an
by pezo1919 7y ago
My favourite orm is Peewee for python.
I really like how clean it is.
grandma = Person.get(Person.name == 'Grandma L.')
or
query = Pet.select().where(Pet.animal_type == 'cat')
for pet in query:
print(pet.name, pet.owner.name)
I am looking for something similar for javascript and lately for Typescript, but I could not find anything with similar readibility and logic.
Do you have any idea?
http://docs.peewee-orm.com/en/latest/peewee/quickstart.html#quickstart http://docs.peewee-orm.com/en/latest/peewee/quickstart.html#...
- ketzo 7y agoI really like Sequelize after using it in a couple of small projects. Not quite that level of concise, but I find it to be a really nice balance of concision and flexibility. Person.findOne({where: {name: "Grandma L."}}) Person.findAll({where: {age: 30}}) Particularly, I really like how associations are handled. If I have a one-to-many association between Posts and Comments, I can do something like this: Post.findOne({where: {title: "My Article}}) .then( article => { article.getComments() .then( comments => { // do something with all comments of Post "My Article" }); }); http://docs.sequelizejs.com/manual/ http://docs.sequelizejs.com/manual/
- coleifer 7y agoHa! Glad to see Peewee mentioned. In two bullet points: predictable apis, compostable pieces...or, learn once, apply anywhere. Or jOOQ but python. Take your pick! If code is your thing, Peewee has quite a few examples: https://github.com/coleifer/peewee/tree/master/examples https://github.com/coleifer/peewee/tree/master/examples