diff options
author | showard <showard@592f7852-d20e-0410-864c-8624ca9c26a4> | 2008-10-03 10:15:50 +0000 |
---|---|---|
committer | showard <showard@592f7852-d20e-0410-864c-8624ca9c26a4> | 2008-10-03 10:15:50 +0000 |
commit | f93d0bb6eb3998f377e2e78a005d5c36bb75e833 (patch) | |
tree | 65316fec755d5b8ed06826e49cfa3671feadf678 /tko/migrations | |
parent | 00c0b023b2b32697d3f815eead036078e4afe55d (diff) |
Add a generic database wrapper, supporting different database backends, to be used by migrate, scheduler, parser (eventually), and maybe others. This will consolidate the multiple database wrappers we have throughout the code and allow us to swap in SQLite for MySQL for unit testing purposes.
-add database/ directory for database libraries. migrate.py will move here soon.
-add database_connection.py under server_common, a basic database wrapper supporting both MySQL and SQLite. PostgreSQL should be an easy future addition (any library supporting Python DB-API should be trivial to add). DatabaseConnection also supports graceful handling of dropped connections.
-add unittest for DatabaseConnection
-change migrate.py to use common DatabaseConnection. Scheduler will be changed to use it in a coming CL and in the future hopefully the TKO parser will be able to use it as well.
-change migrate_unittest.py to use SQLite.
Signed-off-by: Steve Howard <showard@google.com>
git-svn-id: svn://test.kernel.org/autotest/trunk@2234 592f7852-d20e-0410-864c-8624ca9c26a4
Diffstat (limited to 'tko/migrations')
-rwxr-xr-x | tko/migrations/001_initial_db.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/tko/migrations/001_initial_db.py b/tko/migrations/001_initial_db.py index 8b964753..c67f3c2f 100755 --- a/tko/migrations/001_initial_db.py +++ b/tko/migrations/001_initial_db.py @@ -4,8 +4,8 @@ required_tables = ('machines', 'jobs', 'patches', 'tests', 'test_attributes', 'iteration_result') def migrate_up(manager): - manager.execute("SHOW TABLES") - tables = [row[0] for row in manager.cursor.fetchall()] + rows = manager.execute("SHOW TABLES") + tables = [row[0] for row in rows] db_initialized = True for table in required_tables: if table not in tables: |