SQL Alchemy ORM returning a single column, how to avoid common post processing

One way to decrease the clutter in the source is to iterate like this:

results = [r for (r, ) in results]

Although this solution is one character longer than using the [] operator, I think it’s easier on the eyes.

For even less clutter, remove the parenthesis. This makes it harder when reading the code, to notice that you’re actually handling tuples, though:

results = [r for r, in results]

Leave a Comment