Nuria has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/344054 )

Change subject: Adding renamed tables to sql union statements
......................................................................

Adding renamed tables to sql union statements

Code will be merged when rename is finished.

Please see:
https://phabricator.wikimedia.org/T160454

Bug: T160454
Change-Id: Ifcb93b6291c6fa69974906d2a71236fdac0bf575
---
M edit/failure_rates_by_type.sql
M edit/failure_types_by_user_type.sql
M edit/rates.sql
M edit/sessions.sql
M edit/success_by_user_type.sql
5 files changed, 84 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/analytics/limn-edit-data 
refs/changes/54/344054/1

diff --git a/edit/failure_rates_by_type.sql b/edit/failure_rates_by_type.sql
index 05e2500..a4e04e7 100644
--- a/edit/failure_rates_by_type.sql
+++ b/edit/failure_rates_by_type.sql
@@ -55,13 +55,29 @@
             `event_action.saveFailure.type`,
             clientIp,
             event_editingSessionId
+         from Edit_13457736_15423246
+         where
+            event_editor = '{editor}' and
+            ('{wiki}' = 'all' or wiki = '{wiki}') and
+            timestamp >= '{from_timestamp}' and
+            timestamp < '{to_timestamp}'
+
+        union all
+
+         select
+            timestamp,
+            event_action,
+            `event_action.saveFailure.type`,
+            clientIp,
+            event_editingSessionId
          from Edit_13457736
          where
             event_editor = '{editor}' and
             ('{wiki}' = 'all' or wiki = '{wiki}') and
             timestamp >= '{from_timestamp}' and
             timestamp < '{to_timestamp}'
-         ) raw_events
+        
+        ) raw_events
 
          inner join
             (select 'init' as action, 0 as ord
diff --git a/edit/failure_types_by_user_type.sql 
b/edit/failure_types_by_user_type.sql
index 6fbfcfc..edb86cd 100644
--- a/edit/failure_types_by_user_type.sql
+++ b/edit/failure_types_by_user_type.sql
@@ -34,6 +34,19 @@
 
    ( select timestamp, `event_user.class`,
    `event_user.editCount`, `event_action.saveFailure.type`
+   from Edit_13457736_15423246
+   where
+       event_editor = '{editor}' and
+       ('{wiki}' = 'all' or wiki = '{wiki}') and
+       timestamp >= '{from_timestamp}' and
+       timestamp < '{to_timestamp}' and
+       `event_action` = 'saveFailure' and
+       `event_action.saveFailure.type` is not null )
+
+    union all
+
+   ( select timestamp, `event_user.class`,
+   `event_user.editCount`, `event_action.saveFailure.type`
    from Edit_13457736
    where
        event_editor = '{editor}' and
@@ -42,6 +55,7 @@
        timestamp < '{to_timestamp}' and
        `event_action` = 'saveFailure' and
        `event_action.saveFailure.type` is not null )
+
 ) saveFailures
 
 group by 1, 2
diff --git a/edit/rates.sql b/edit/rates.sql
index eef80db..d905cd5 100644
--- a/edit/rates.sql
+++ b/edit/rates.sql
@@ -15,6 +15,7 @@
                date(timestamp) as day,
                group_concat(event_action order by timestamp, action_order.ord 
separator '-') as actions
              from (
+
                 select
                    timestamp,
                    event_action,
@@ -36,13 +37,28 @@
                    event_action,
                    clientIp,
                    event_editingSessionId
+                from Edit_13457736_15423246
+                where
+                   event_editor = '{editor}' and
+                   ('{wiki}' = 'all' or wiki = '{wiki}') and
+                   timestamp >= '{from_timestamp}' and
+                   timestamp < '{to_timestamp}'
+
+               union all
+
+                select
+                   timestamp,
+                   event_action,
+                   clientIp,
+                   event_editingSessionId
                 from Edit_13457736
                 where
                    event_editor = '{editor}' and
                    ('{wiki}' = 'all' or wiki = '{wiki}') and
                    timestamp >= '{from_timestamp}' and
                    timestamp < '{to_timestamp}'
-                ) raw_events
+            
+            ) raw_events
 
                 inner join
                    (select 'init' as action, 0 as ord
diff --git a/edit/sessions.sql b/edit/sessions.sql
index 130f090..70c817a 100644
--- a/edit/sessions.sql
+++ b/edit/sessions.sql
@@ -2,7 +2,24 @@
         actions,
         count(*) as repeated
    from (select group_concat(event_action order by timestamp, action_order.ord 
separator '-') as actions
-           from (select timestamp,
+           from (
+            select timestamp,
+                        event_action,
+                        clientIp,
+                        event_editingSessionId
+
+                   from Edit_13457736_15423246
+                        # NOTE: used to union all with Edit_11448630
+                        # That schema is still used apparently, but very little
+
+                  where event_editor = '{editor}'
+                    and ('{wiki}' = 'all' or wiki = '{wiki}')
+                    and timestamp >= '{from_timestamp}'
+                    and timestamp < '{to_timestamp}'
+
+            union all
+
+            select timestamp,
                         event_action,
                         clientIp,
                         event_editingSessionId
@@ -15,6 +32,7 @@
                     and ('{wiki}' = 'all' or wiki = '{wiki}')
                     and timestamp >= '{from_timestamp}'
                     and timestamp < '{to_timestamp}'
+            
                 ) raw_events
 
                     inner join
diff --git a/edit/success_by_user_type.sql b/edit/success_by_user_type.sql
index 587944c..546af2a 100644
--- a/edit/success_by_user_type.sql
+++ b/edit/success_by_user_type.sql
@@ -52,13 +52,29 @@
                    event_editingSessionId,
                    `event_user.class`,
                    `event_user.editCount` as edit_count
+                from Edit_13457736_15423246
+                where
+                   event_editor = '{editor}' and
+                   ('{wiki}' = 'all' or wiki = '{wiki}') and
+                   timestamp >= '{from_timestamp}' and
+                   timestamp < '{to_timestamp}'
+                
+                union all
+
+                select
+                   timestamp,
+                   event_action,
+                   clientIp,
+                   event_editingSessionId,
+                   `event_user.class`,
+                   `event_user.editCount` as edit_count
                 from Edit_13457736
                 where
                    event_editor = '{editor}' and
                    ('{wiki}' = 'all' or wiki = '{wiki}') and
                    timestamp >= '{from_timestamp}' and
                    timestamp < '{to_timestamp}'
-                ) raw_events
+            ) raw_events
 
              inner join
                 (select 'init' as action, 0 as ord

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ifcb93b6291c6fa69974906d2a71236fdac0bf575
Gerrit-PatchSet: 1
Gerrit-Project: analytics/limn-edit-data
Gerrit-Branch: master
Gerrit-Owner: Nuria <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to