Yuvipanda has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/182799

Change subject: Add base table name to indexed views
......................................................................

Add base table name to indexed views

Needed for views like revision_userindex, etc so that we know
what is the source table used for them

Change-Id: I5866f3108829fc94c698bab480367de2bbbe2c91
---
M auditor/models.py
M greylisted.yaml
2 files changed, 13 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/software/labsdb-auditor 
refs/changes/99/182799/1

diff --git a/auditor/models.py b/auditor/models.py
index 4d75ee8..cd467c5 100644
--- a/auditor/models.py
+++ b/auditor/models.py
@@ -43,10 +43,11 @@
 
 
 class Table(object):
-    def __init__(self, name, columns=[], where=None):
+    def __init__(self, name, columns=[], where=None, table_name=None):
         self.name = name
         self.columns = columns
         self.where = where
+        self.table_name = table_name if table_name else name
 
     def add_column(self, column):
         self.columns.append(column)
@@ -72,11 +73,13 @@
                 if c.replacewith:
                     columndict['replacewith'] = c.replacewith
                 tabledict['columns'][c.name] = columndict
+        if self.table_name != self.name:
+            tabledict['table_name'] = self.table_name
         return tabledict
 
     @classmethod
     def from_dict(cls, tablename, tabledata):
-        table = cls(tablename, [], tabledata.get('where', None))
+        table = cls(tablename, [], tabledata.get('where', None), 
tabledata.get('table_name', None))
         if isinstance(tabledata['columns'], list):
             # Whitelisted table
             for colname in tabledata['columns']:
diff --git a/greylisted.yaml b/greylisted.yaml
index a273c15..8492f5c 100644
--- a/greylisted.yaml
+++ b/greylisted.yaml
@@ -184,6 +184,7 @@
       condition: ar_deleted & 4
       whitelisted: false
 archive_userindex:
+  table_name: archive
   columns:
     ar_comment:
       whitelisted: false
@@ -282,6 +283,7 @@
       condition: fa_deleted & 1
       whitelisted: false
 filearchive_userindex:
+  table_name: filearchive
   columns:
     fa_archive_name:
       whitelisted: true
@@ -382,6 +384,7 @@
       whitelisted: true
   where: ipb_deleted = 0
 ipblocks_ipindex:
+  table_name: ipblocks
   columns:
     ipb_address:
       whitelisted: true
@@ -457,6 +460,7 @@
       whitelisted: false
   where: logtype != 'suppress'
 logging_logindex:
+  table_name: logging
   columns:
     log_action:
       whitelisted: true
@@ -488,6 +492,7 @@
       whitelisted: false
   where: (log_deleted & 1) = 0 AND logtype != 'suppress'
 logging_userindex:
+  table_name: logging
   columns:
     log_action:
       condition: log_deleted & 1
@@ -582,6 +587,7 @@
     oi_width:
       whitelisted: true
 oldimage_userindex:
+  table_name: oldimage
   columns:
     oi_archive_name:
       whitelisted: true
@@ -673,6 +679,7 @@
       condition: rc_deleted & 4
       whitelisted: false
 recentchanges_userindex:
+  table_name: recentchanges
   columns:
     rc_bot:
       whitelisted: true
@@ -763,6 +770,7 @@
       condition: rev_deleted & 4
       whitelisted: false
 revision_userindex:
+  table_name: revision
   columns:
     rev_comment:
       condition: rev_deleted & 2

-- 
To view, visit https://gerrit.wikimedia.org/r/182799
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5866f3108829fc94c698bab480367de2bbbe2c91
Gerrit-PatchSet: 1
Gerrit-Project: operations/software/labsdb-auditor
Gerrit-Branch: master
Gerrit-Owner: Yuvipanda <yuvipa...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to