Skip to content

Instantly share code, notes, and snippets.

@questsin
Created February 20, 2019 18:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save questsin/44040983b4b22a15640bd7a31ce7dd26 to your computer and use it in GitHub Desktop.
Save questsin/44040983b4b22a15640bd7a31ce7dd26 to your computer and use it in GitHub Desktop.
http://sqlitebrowser.org/
import sqlite3
from sqlite3 import Error
pip install bash_kernel
python -m bash_kernel.install
python setup.py install
python -m sqlite3_kernel.install
Description
.show Displays current settings for various parameters
.databases Provides database names and files
.quit Quit sqlite3 program
.tables Show current tables
.schema Display schema of table
.header Display or hide the output table header
.mode Select mode for the output table
.dump Dump database in SQL text format
import sqlite3
sqlite3.version
db = sqlite3.connect('data/test.db')
dbm = db = sqlite3.connect(':memory:')
db.close()
dbm.close()
cursor = db.cursor()
cursor.execute('''DROP TABLE books''')
db.commit()
cursor.execute('SELECT * FROM fib')
print(cursor.fetchall())
df = pd.read_sql_query(sql, connection)
df.to_sql('trips', connection, if_exists='append', index=False)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment