Example #1
0
def load_menu(db, args, parent):
	conn = get_db_connection(db)
	# Used for file loading additional indices
	for arg in args:
		print arg
		fp = open(arg, 'r')
		struct = json.load(fp)
		fp.close()
		curs = conn.cursor()
		try:
			load_menu_structure(curs, struct)
			create_sort(conn)
			conn.commit()
		finally:
			curs.close()
Example #2
0
def load_menu(db, args, parent):
    conn = get_db_connection(db)
    # Used for file loading additional indices
    for arg in args:
        print arg
        fp = open(arg, 'r')
        struct = json.load(fp)
        fp.close()
        curs = conn.cursor()
        try:
            load_menu_structure(curs, struct)
            create_sort(conn)
            conn.commit()
        finally:
            curs.close()
Example #3
0
def load_spell_data(db):
    conn = get_db_connection(db)
    curs = conn.cursor()
    find_central_index(curs, **{"type": "spell"})
    index_lines = curs.fetchall()
    batch = []
    batcher = ParseBatcher()
    count = 0
    for line in index_lines:
        spell = get_parse_spell(line['url'])
        if spell:
            batch.append(make_spell(conn, line, spell))
        else:
            batch.append(make_spell(conn, line))
        if len(batch) >= 50:
            batcher.batch_save(batch)
            batch = []
            count += 50
            print "Saving through %s" % count
    batcher.batch_save(batch)
def load_spell_data(db):
	conn = get_db_connection(db)
	curs = conn.cursor()
	find_central_index(curs, **{"type": "spell"})
	index_lines = curs.fetchall()
	batch = []
	batcher = ParseBatcher()
	count = 0
	for line in index_lines:
		spell = get_parse_spell(line['url'])
		if spell:
			batch.append(make_spell(conn, line, spell))
		else:
			batch.append(make_spell(conn, line))
		if len(batch) >= 50:
			batcher.batch_save(batch)
			batch = []
			count += 50
			print "Saving through %s" % count
	batcher.batch_save(batch)