Skip to content

Instantly share code, notes, and snippets.

@pfmoore
Created September 22, 2020 20:59
Show Gist options
  • Save pfmoore/a5bfdede9646bb7be0dc4d7b445aa338 to your computer and use it in GitHub Desktop.
Save pfmoore/a5bfdede9646bb7be0dc4d7b445aa338 to your computer and use it in GitHub Desktop.
A SQL query runner using Pandas
# A SQL query runner using Pandas
# pip install pandas tabulate sqlalchemy
import pandas as pd
from tabulate import tabulate
# import sqlite3
df = pd.read_sql(
"select name, downloaded, serial from projects limit 20",
"sqlite:///PyPI.db"
# sqlite3.connect("PyPI.db")
)
print(tabulate(df, headers='keys', tablefmt='psql'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment