Commit 6c6915ae authored by inkhey's avatar inkhey

table instead of view (better performance)

parent 707b21ba
......@@ -237,7 +237,7 @@ class sqlGit(object):
'''View with 3 types of nodes : author,commit,file'''
c = self.conn.cursor()
c.execute(
'''create view nodes as
'''create table nodes as
select f.dir || f.name as id ,
f.size as taille,
f.dir as dir,
......@@ -282,7 +282,7 @@ class sqlGit(object):
from commits;
''')
c.execute(
'''create view edges as
'''create table edges as
select author_name || author_mail as source,
commits as target,
author_name,
......@@ -301,7 +301,7 @@ class sqlGit(object):
'''View with 2 types of nodes : author,file'''
c = self.conn.cursor()
c.execute('''create view nodes as
c.execute('''create table nodes as
select f.dir || f.name as id ,
f.size as taille,
f.dir as dir,
......@@ -328,7 +328,7 @@ class sqlGit(object):
where a.email=da.email
and a.name=da.name''')
c.execute(''' create view edges as
c.execute(''' create table edges as
select
lac.author_name || lac.author_mail as source,
lfc.dir || lfc.file as target,
......@@ -352,7 +352,7 @@ class sqlGit(object):
'''View of relation between files'''
c = self.conn.cursor()
c.execute('''create view nodes as
c.execute('''create table nodes as
select f.dir || f.name as id ,
f.size as taille,
f.dir as dir,
......@@ -364,7 +364,7 @@ class sqlGit(object):
and f.name=df.file;''')
c.execute('''
create view edges as
create table edges as
select f1.file AS source , f2.file AS target,
count(distinct(f1.author)) as nbAuthors,
count(distinct(f1.author)) as weight
......@@ -395,7 +395,7 @@ class sqlGit(object):
'''View of relation between authors'''
c = self.conn.cursor()
c.execute('''
create view nodes as
create table nodes as
select distinct( a.name || a.email) as id,
a.name as name,
a.email as email,
......@@ -407,7 +407,7 @@ class sqlGit(object):
and a.name=da.name;''')
c.execute('''
create view edges as
create table edges as
select a1.author AS source , a2.author AS target,
count(a1.file) as nbfile,
count(a1.file) as weight,
......@@ -473,7 +473,7 @@ class sqlGit(object):
c = self.conn.cursor()
listTable = ('nodes', 'edges')
for table in listTable:
c.execute('DROP VIEW IF EXISTS ' + table + ' ;')
c.execute('DROP TABLE IF EXISTS ' + table + ' ;')
self.conn.commit()
# autotest
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment