Usage

Import

import sqlite3

Set up cursor

conn = sqlite3.connect('trends.db')
cur = conn.cursor()

Create table

drop_query = 'DROP TABLE IF EXISTS foo;'
cur.execute(drop_query)

create_query = """\
CREATE TABLE IF NOT EXISTS foo (
    id INTEGER PRIMARY KEY,
    bar VARCHAR(50)
    baz INTEGER
    updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
"""
cur.execute(create_query)

Insert

insert_sql = """
    INSERT INTO foo (bar, baz, updated_at)
             VALUES (?, ?, CURRENT_TIMESTAMP);
"""
cur.execute(insert_sql, "Fizz", 123)

Select

select_sql = """
    SELECT *
    FROM foo;
"""

cur.execute(select_sql)

for row in cur:
    print(row)