1
|
1 import sqlite3
|
|
2 import urllib2
|
|
3
|
0
|
4 class TalosNames(object):
|
|
5 graphserver_sql = 'http://hg.mozilla.org/graphs/raw-file/tip/sql/data.sql'
|
1
|
6 schema = 'http://hg.mozilla.org/graphs/raw-file/tip/sql/schema.sql'
|
|
7
|
2
|
8 tables = {'os_list': '(id, name text)',
|
|
9 'branches': '(id, name text)'
|
|
10 'machines': '(id, os_id int, is_throttling int, cpu_speed text, name text, is_active int, date_added int)',
|
|
11 'pagesets': '(id, name text)',
|
|
12 'tests': '(id, name text, pretty_name text, is_chrome int, is_active int, pageset_id int)'
|
|
13 }
|
1
|
14
|
0
|
15 def __init__(self):
|
1
|
16 self.db = sqlite3.connect(':memory:')
|
2
|
17 data = urllib2.urlopen(self.graphserver_sql).read()
|
1
|
18 cursor = self.db.cursor()
|
2
|
19 for table, schema in self.tables.items():
|
|
20 cursor.execute("""CREATE TABLE %s %s""" % (table, schema))
|
|
21 self.db.commit()
|
|
22 cursor.close()
|
1
|
23
|