json - How to implement a database in python? -
i want create database because have lot of items , each of them have lot of attributes (a large dataset).
i first tried create json file each tuple (attribute0, attribute1), in large scale it's impossible so. tried split data multiple json files: 1 file per attribute unique id each value, , 1 per tuple (attribute0, attribute1) using id of values. worked better, not better because each time had read single value had read files. tried split files according hash of values, problem link between attributes. cannot know find specific index because have read every single file in order find one.
you can use sqlite database can setup in no time. python's sqlite3
module easy use. example below docs.
import sqlite3 conn = sqlite3.connect('example.db') c = conn.cursor() # create table c.execute('''create table stocks (date text, trans text, symbol text, qty real, price real)''') # insert row of data c.execute("insert stocks values ('2006-01-05','buy','rhat',100,35.14)")
sqlite databases data sizes of several gb. since using json files before sounds solve problem. article gives intro sqlite in general.
Comments
Post a Comment