I have a handful of functions within an application's "library api" that share a similar intent in functionality and return values, but query for discrete types of objects. I'm working on standardizing them right now and could use some feedback.
case 1 is simple: results = dbSession.query(Foo.id, case(..)).all() results is a `list` results[0] is an instance of `sqlalchemy.util._collections.result` case 2 is where i'm stuck - some queries are a bit complex and still in raw SQL.. results = dbSession.execute(text("SELECT id, id_bar FROM foo WHERE ...")).all() results is a `sqlalchemy.engine.result.ResultProxy` instance if I consume all rows as `results = [i for i in results]` then `results[0]` is a `sqlalchemy.engine.result.RowProxy` I need to ensure the latter form is a list of tuples, like the former, so it can be used by various encoders and libraries that look for a list/tuple in that objects MRO. Right now I'm manually doing this and documenting the rationale. But is there anything in the sqlalchemy api that would streamline turning the second form into something where a tuple/list is involved - perhaps bypassing the RowProxy step? I couldn't find anything in the docs. -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http://www.sqlalchemy.org/ To post example code, please provide an MCVE: Minimal, Complete, and Verifiable Example. See http://stackoverflow.com/help/mcve for a full description. --- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at https://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.