summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntanas Uršulis <antanas.ursulis@gmail.com>2013-07-30 01:36:51 +0300
committerAntanas Uršulis <antanas.ursulis@gmail.com>2013-07-30 01:36:51 +0300
commita436a8360d42232c1285e0979f3c561579bba591 (patch)
tree3090be9c528aa686cb0117cd135ba333d3d70f92
parentDatabase (SQL) class for functionality common across all processors (diff)
downloadlog-analysis-a436a8360d42232c1285e0979f3c561579bba591.tar.gz
log-analysis-a436a8360d42232c1285e0979f3c561579bba591.tar.bz2
log-analysis-a436a8360d42232c1285e0979f3c561579bba591.zip
Add hostname to schema
-rw-r--r--database.py4
-rw-r--r--portage_processor.py3
-rw-r--r--schema.sql1
3 files changed, 5 insertions, 3 deletions
diff --git a/database.py b/database.py
index 5202876..79ae693 100644
--- a/database.py
+++ b/database.py
@@ -11,9 +11,9 @@ class DatabaseConnection:
self.conn.commit()
return c.lastrowid
- def insert_group(self, name, provider, date):
+ def insert_group(self, hostname, name, provider, date):
with closing(self.conn.cursor()) as c:
- c.execute("insert into `groups` (`name`, `provider`, `date`) values (%s, %s, %s)", (name, provider, date))
+ c.execute("insert into `groups` (`hostname`, `name`, `provider`, `date`) values (%s, %s, %s, %s)", (hostname, name, provider, date))
self.conn.commit()
return c.lastrowid
diff --git a/portage_processor.py b/portage_processor.py
index 66fb970..32ca9c4 100644
--- a/portage_processor.py
+++ b/portage_processor.py
@@ -14,7 +14,8 @@ class PortageProcessor:
self.storage = storage
def process(self, request, source, db):
- group_id = db.insert_group(request.group_name, 'portage', int(time.time()))
+ group_id = db.insert_group(source, request.group_name, 'portage', int(time.time()))
+
for f in request.files:
matches = 0
pkg_failed = False
diff --git a/schema.sql b/schema.sql
index 564385e..6b418a8 100644
--- a/schema.sql
+++ b/schema.sql
@@ -6,6 +6,7 @@ create table if not exists `files` (
create table if not exists `groups` (
`id` int primary key auto_increment,
+ `hostname` varchar(255) not null,
`name` text not null,
`provider` varchar(16) not null,
`date` int not null