diff options
author | 2013-07-30 01:38:23 +0300 | |
---|---|---|
committer | 2013-07-30 01:38:23 +0300 | |
commit | 7ba5f957c082545a9eb097839fdc7eba826a7d80 (patch) | |
tree | cb10b75ef04167ea7ac127f5fb882b11fdc4cfe5 /portage_database.py | |
parent | Add hostname to schema (diff) | |
download | log-analysis-7ba5f957c082545a9eb097839fdc7eba826a7d80.tar.gz log-analysis-7ba5f957c082545a9eb097839fdc7eba826a7d80.tar.bz2 log-analysis-7ba5f957c082545a9eb097839fdc7eba826a7d80.zip |
Implement additional metadata storage for logs received from Portage
Flags like 'pkg_failed', 'test_failed', etc. are stored once per group.
This is a discussion item, as it might make sense to store some data
once per file instead.
Diffstat (limited to 'portage_database.py')
-rw-r--r-- | portage_database.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/portage_database.py b/portage_database.py new file mode 100644 index 0000000..ca7831c --- /dev/null +++ b/portage_database.py @@ -0,0 +1,12 @@ +from contextlib import closing +from database import DatabaseConnection + +class PortageDatabaseConnection(DatabaseConnection): + def __init__(self, db): + super(PortageDatabaseConnection, self).__init__(db.conn) + + # TODO: consider passing these arguments around in a dictionary or kwargs + def insert_group_extra(self, group_id, pkg_name, matches, pkg_failed, test_failed, collision, bug_assignee, bug_cc): + with closing(self.conn.cursor()) as c: + c.execute("insert into `groups_portage` values (%s, %s, %s, %s, %s, %s, %s, %s)", (group_id, pkg_name, matches, pkg_failed, test_failed, collision, bug_assignee, bug_cc)) + self.conn.commit() |