Most engineers who say they want an ORM, really want query composition.
What’s a good solution for that without a classic ORM?
Flyweight: An ORM for SQLite
31–40 of 105 posts
Re: Flyweight: An ORM for SQLite
#32Does anyone know of a library similar to slonik[0] for SQLite in the NodeJS space? I generally reach for TypeORM and have tried MikroORM lately but didn’t really like it. But what I really want is something like slonik which is more focused on querying than relational mapping. [0]: https://github.com/gajus/slonik
Re: Flyweight: An ORM for SQLite
#33Does anyone know of a library similar to slonik[0] for SQLite in the NodeJS space? I generally reach for TypeORM and have tried MikroORM lately but didn’t really like it. But what I really want is something like slonik which is more focused on querying than relational mapping. [0]: https://github.com/gajus/slonik
It uses Knex as the query builder so maybe you can just use that directly: https://knexjs.org/
Although, I would use Mikro still to manage schema and migrations. Then drop down to Knex: https://mikro-orm.io/docs/query-builder#using-knexjs
Re: Flyweight: An ORM for SQLite
#34Most engineers who say they want an ORM, really want query composition.
Re: Flyweight: An ORM for SQLite
#35Re: Flyweight: An ORM for SQLite
#36const fights = await db.fights.get({ cardId: 9, titleFight: true }); translates to select * from fights where cardId = 9 and titleFight = 1; Confession: something about ORMs has never clicked with me.. none of them ever seem simpler than SQL.
Where ORMs are useful is once you have your objects. The usefulness of an ORM is being able to say:
user.email = 'new@example.com'
user.groups.append('admin')
user.save()
Also being able to work on your data in objects or structure native to your programming language means that you can leverage both the strengths of the language and the database server. Some operations are much simpler to do in Python or C#, compared to SQL. In other scenarios you really need to let the database do its thing. Again, you do have a point, because believing that you can skip learning SQL and just rely on the ORM will get you into trouble.One other feature of ORMs is that they allow you to write code that will run on multiple databases, but at the cost of not being able to use the more advanced database features. For many CRUD applications that is a price worth paying though.
Re: Flyweight: An ORM for SQLite
#37https://github.com/Aperocky/sqlitedao
https://pypi.org/project/sqlitedao
Same concept, huge speed boost to personal projects. ORM is great because you can abstract items in memory directly into persistence, and define the relation in programming language instead of SQL.
Re: Flyweight: An ORM for SQLite
#38Most engineers who say they want an ORM, really want query composition.
I don't really care about the query, just that it's inserted correctly, along with other operations that an ORM provide (get/delete/update,etc)
Re: Flyweight: An ORM for SQLite
#39const fights = await db.fights.get({ cardId: 9, titleFight: true }); translates to select * from fights where cardId = 9 and titleFight = 1; Confession: something about ORMs has never clicked with me.. none of them ever seem simpler than SQL.
It's more about the Mapping than the querying. Luckily good ORMs let you fetch your objects using... SQL, which is a fine language for querying (doh): for p in Person.objects.raw('SELECT * FROM myapp_person'): print(p)
Re: Flyweight: An ORM for SQLite
#40Why a whole new ORM and not an SQLite adapter for an existing ORM?
Jokes aside, as someone who wrote a python sqlite ORM (shameless plug: `pip install sqlitedao`), my reason was to have a minimal ORM for personal project, the entire active source is contained in one file and it works for majority of the use cases (i.e. insert_item, get_item, etc).