# HG changeset patch # User Jeff Hammel # Date 1341780786 25200 # Node ID c98f2a3835950803056514767d66e3c8c70c1a73 # Parent a10ae1ea8325ed0ce97c5e8ff85a637ba2807eec make some tables diff -r a10ae1ea8325 -r c98f2a383595 README.txt --- a/README.txt Sun Jul 08 10:09:51 2012 -0700 +++ b/README.txt Sun Jul 08 13:53:06 2012 -0700 @@ -9,8 +9,8 @@ * http://hg.mozilla.org/build/talos/file/tip/talos/test.py * https://bugzilla.mozilla.org/show_bug.cgi?id=770460 * http://hg.mozilla.org/users/mstange_themasta.com/tinderboxpushlog/file/tip/js/Config.js#l302 +* http://hg.mozilla.org/graphs/raw-file/tip/sql/data.sql * http://hg.mozilla.org/graphs/raw-file/tip/sql/schema.sql -* http://hg.mozilla.org/graphs/raw-file/tip/sql/data.sql ---- diff -r a10ae1ea8325 -r c98f2a383595 talosnames/api.py --- a/talosnames/api.py Sun Jul 08 10:09:51 2012 -0700 +++ b/talosnames/api.py Sun Jul 08 13:53:06 2012 -0700 @@ -5,17 +5,19 @@ graphserver_sql = 'http://hg.mozilla.org/graphs/raw-file/tip/sql/data.sql' schema = 'http://hg.mozilla.org/graphs/raw-file/tip/sql/schema.sql' - tables = ['os_list', - 'branches', - 'machines', - 'pagesets', - 'tests'] + tables = {'os_list': '(id, name text)', + 'branches': '(id, name text)' + 'machines': '(id, os_id int, is_throttling int, cpu_speed text, name text, is_active int, date_added int)', + 'pagesets': '(id, name text)', + 'tests': '(id, name text, pretty_name text, is_chrome int, is_active int, pageset_id int)' + } def __init__(self): self.db = sqlite3.connect(':memory:') - for table in self.tables: - pass - schema = urllib2.urlopen(self.schema).read() + data = urllib2.urlopen(self.graphserver_sql).read() cursor = self.db.cursor() - cursor.executescript(schema) + for table, schema in self.tables.items(): + cursor.execute("""CREATE TABLE %s %s""" % (table, schema)) + self.db.commit() + cursor.close()