Last active
October 2, 2022 19:08
-
-
Save johnny-godoy/532bca5509c810317febffe6354400c8 to your computer and use it in GitHub Desktop.
Function for getting pretty-printable tables out of sqlalchemy queries
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from __future__ import annotations | |
import tabulate | |
def tabulate_query(query: Query, **kwargs): | |
return tabulate.tabulate(query, | |
headers=(column.get('name') for column in query.column_descriptions), | |
**kwargs) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment