sqlite3 python install code example
Example 1: install sqlite3 python
pip install pysqlite3
Example 2: how to install sqlite3 in python
pip install sqlite
Example 3: how to install sqlite3 in python
if you are using python3, sqlite3 is built in into it.
Example 4: sqlite3 python
import sqlite3 as lite
import sys
try:
con = lite.connect('products.db')
cur = con.cursor()
cur.execute("CREATE TABLE drinks(Id INTEGER PRIMARY KEY AUTOINCREMENT, Name TEXT, Price REAL)")
cur.execute("CREATE TABLE fruits(Id INTEGER PRIMARY KEY AUTOINCREMENT, Name TEXT, Price REAL)")
con.commit()
except e:
if con:
con.rollback()
print("Unexpected error %s:" % e.args[0])
sys.exit(1)
finally:
if con:
con.close()
Example 5: how to install sqlite3 in python
$chmod +x sqlite.py
$./sqlite.py
Open database successfully
Example 6: how to install sqlite3 in python
from sqlalchemy import create_engineengine = create_engine('sqlite:///:memory:')dff.to_sql('mySQLtable', con = engine)sqldf = pd.read_sql('mySQLtable', con = engine)sqldf