4 ms·
I'm relatively new to Python and I was looking for something like this. I do wonder if there is a well-known Python equivalent of Dapper: https://github.com/Sta
by stasa 6y ago
I'm relatively new to Python and I was looking for something like this. I do wonder if there is a well-known Python equivalent of Dapper: https://github.com/StackExchange/Dapper https://github.com/StackExchange/Dapper
- aikah 6y agoYou don't need Dapper for Python. Python is a dynamic language. If your problem is hydration[0] it can be done easily, even with Python classes. https://stackoverflow.com/questions/13337629/create-an-instance-of-a-class-from-sql-query https://stackoverflow.com/questions/13337629/create-an-insta... For query building SQLAlchemy can do that and more. I think that, with JSON support in most RDBMS, ORM as a concept has become way easier to handle. I come to think that this is the promise of the 90's Object oriented databases being fulfilled somehow. [0]:https://stackoverflow.com/questions/6991135/what-does-it-mean-to-hydrate-an-object https://stackoverflow.com/questions/6991135/what-does-it-mea...
- stasa 6y agoHydration is not a big problem. However, Dapper does much more than that: it handles multi-mapping (eg mapping users and posts from a single query), query parameterization etc. Surely, you can do it all ad hoc, but Dapper provides very convenient set of primitives out of the box.
- aikah 6y ago> it handles multi-mapping (eg mapping users and posts from a single query) You can achieve all that with JSON support in SQL, which most RDBMS have. You can then de-serialize JSON rows into Python objects. No need for an ORM.