JSON >> SQLObject


from simplejson import *
from sqlobject import *

sqlhub.processConnection = connectionForURI("sqlite:domains.db")

class Domain(SQLObject):
domain_name = StringCol(length=64, alternateID=True)
create_date = DateCol()
expiry_date = DateCol()
organization_name = StringCol(length=64)
Domain.dropTable(ifExists=True)
Domain.createTable()

domainsJson = load(file("domains.json", "r"), encoding="utf-8")

for row in domainsJson["rows"]:
Domain(
domain_name=row[0],
create_date=row[1],
expiry_date=row[2],
organization_name=row[3])