-
-
Save phracker/56bc1219202e5d2f905c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding:utf-8 -*- | |
import json | |
import sqlite3 | |
JSON_FILE = "some.json" | |
DB_FILE = "some.db" | |
traffic = json.load(open(JSON_FILE)) | |
conn = sqlite3.connect(DB_FILE) | |
foo = traffic[0]["foo"] | |
bar = traffic[0]["bar"] | |
data = [foo, bar] | |
c = conn.cursor() | |
c.execute('create table table_name (foo, bar)') | |
c.execute('insert into table_name values (?,?)', data) | |
conn.commit() | |
c.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment