Skip to content

Instantly share code, notes, and snippets.

@mariomartinezsz
Created January 5, 2013 22:38
Show Gist options
  • Save mariomartinezsz/4464096 to your computer and use it in GitHub Desktop.
Save mariomartinezsz/4464096 to your computer and use it in GitHub Desktop.
Create a SQLite db and a table with Python
import sqlite3
cnn = sqlite3.connect('mydata.db')
mycursor = cnn.cursor()
# create table
sql_new_table = '''create table products
(code text, desc text, value real)'''
mycursor.execute(sql_new_table)
cnn.commit()
mycursor.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment