I'm building a webapp for a small business, which is supposed to be some sort of mini ERP. The webapp is built with AngularJS, so I'm using the server side mostly to manage the database and provide a nice REST api.
I really like working with ORMs, and it really fits my needs. I chose SQLAlchemy for my database layer since I find it very easy and convenient to work with (and I also love Python). However, when using SQLAlchemy's ORM layer, and you want to query some entities for results (including its children when necessary), it executes the query requested (which is quite fast), but then, whenever it gets the results, it creates a Python object for each result, and also (to my understanding), does a lot of work maintaining those result objects, allowing the user to work with them and keep them in sync with the database. However, wrapping the results and creating SQLAlchemy entities (I think it's called unit-of-work in SQLAlchemy), is very very slow (few thousands results take few seconds to finish), as opposed to just getting the results (in tuples) which is pretty fast.
Thing is, since I'm using AngularJS, all I want is that those results will be converted to JSON, instead of converting them first to Python objects and doing tons of unnecessary work. I really like working with the ORM, since it helps you manage nested queries and relationships, however if I won't have a choice, I will probably fall back to SQLAlchemy Core, but it's going to be very hard for me to parse the results into JSON objects (and managing all those queries for the REST apis, which some of them are going to be custom queries constructed by the user... it's a management system after all...). SQLAlchemy's ORM already does the results parsing and generating the queries, I just want to it create JSON objects (which can actually be just Python's dictionaries and lists), rather than creating pure Python objects.
Ideas how to accomplish what I want?
TL;DR:
Read title.