Skip to content

Instantly share code, notes, and snippets.

@aniruddha27
Created March 20, 2020 20:04
Show Gist options
  • Save aniruddha27/871847694f45e613b497c325066b26f4 to your computer and use it in GitHub Desktop.
Save aniruddha27/871847694f45e613b497c325066b26f4 to your computer and use it in GitHub Desktop.
import pandas as pd
import sqlite3
# open engine connection
con=sqlite3.connect('./Importing files/sample_test.db')
# create a cursor object
cur = con.cursor()
# Perform query: rs
rs = cur.execute('select * from TEST')
# Save results of the query to DataFrame: df
df = pd.DataFrame(rs.fetchall())
# Close connection
con.commit()
# Print head of DataFrame df
df
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment