r91622 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r91621‎ | r91622 | r91623 >
Date:00:10, 7 July 2011
Author:ezachte
Status:deferred
Tags:
Comment:
Modified paths:
  • /trunk/wikistats/analytics/analytics_refresh_from_csv.txt (modified) (history)

Diff [purge]

Index: trunk/wikistats/analytics/analytics_refresh_from_csv.txt
@@ -1,101 +1,6 @@
2 -
32 USE `analytics` ;
43
5 -CREATE TABLE `comscore` (
6 - `date` date NOT NULL,
7 - `country_code` varchar (3),
8 - `region_code` varchar (3),
9 - `web_property` varchar (20),
10 - `project_code` varchar (10),
11 - `reach` decimal (4,1) DEFAULT NULL,
12 - `visitors` decimal (15) DEFAULT NULL,
13 - PRIMARY KEY (date,country_code,region_code,project_code,web_property),
14 - KEY (`country_code`)
15 -) ;
16 -
17 -CREATE TABLE `comscore_regions` (
18 - `region_code` varchar (2),
19 - `report_language` varchar (10),
20 - `region_name` varchar (18),
21 - PRIMARY KEY (report_language,region_code)
22 -) ;
23 -
24 -CREATE TABLE `wikistats` (
25 - `date` date NOT NULL,
26 - `project_code` varchar (10),
27 - `language_code` varchar (15),
28 - `editors_all_time` int (10) DEFAULT NULL,
29 - `editors_new` int (7) DEFAULT NULL,
30 - `editors_ge_5` int (7) DEFAULT NULL,
31 - `editors_ge_25` int (7) DEFAULT NULL,
32 - `editors_ge_100` int (7) DEFAULT NULL,
33 - `articles` int (12) DEFAULT NULL,
34 - `articles_new_per_day` int (9) DEFAULT NULL,
35 - `articles_over_bytes_500` int (12) DEFAULT NULL,
36 - `articles_over_bytes_2000` int (12) DEFAULT NULL,
37 - `edits_per_article` decimal (9,1) DEFAULT NULL,
38 - `bytes_per_article` decimal (9,1) DEFAULT NULL,
39 - `edits` int (12) DEFAULT NULL,
40 - `size_in_bytes` int (15) DEFAULT NULL,
41 - `size_in_words` int (15) DEFAULT NULL,
42 - `links_internal` int (15) DEFAULT NULL,
43 - `links_interwiki` int (15) DEFAULT NULL,
44 - `links_image` int (15) DEFAULT NULL,
45 - `links_external` int (15) DEFAULT NULL,
46 - `redirects` int (15) DEFAULT NULL,
47 - PRIMARY KEY (date,project_code,language_code)
48 -) ;
49 -
50 -CREATE TABLE `page_views` (
51 - `date` date NOT NULL,
52 - `project_code` char (2),
53 - `language_code` char (15),
54 - `views_non_mobile_raw` bigint (15),
55 - `views_mobile_raw` bigint (15),
56 - `views_non_mobile_normalized` bigint (15),
57 - `views_mobile_normalized` bigint (15),
58 - `views_raw` bigint (15),
59 - `views_normalized` bigint (15),
60 - PRIMARY KEY (date,project_code,language_code)
61 -) ;
62 -
63 -CREATE TABLE `language_names` (
64 - `report_language` varchar (15),
65 - `language_code` varchar (15),
66 - `language_name` varchar (50),
67 - PRIMARY KEY (report_language,language_code)
68 -) ;
69 -
70 -CREATE TABLE `binaries` (
71 - `date` date NOT NULL,
72 - `project_code` char (2),
73 - `language_code` char (15),
74 - `extension` varchar (10),
75 - `binaries` bigint (15),
76 - PRIMARY KEY (date,project_code,language_code,extension)
77 -) ;
78 -
79 -CREATE TABLE `offline` (
80 - `date` date NOT NULL,
81 - `readers` bigint (12),
82 - PRIMARY KEY (date,readers)
83 -) ;
84 -
85 -
86 -
87 -
88 -TRUNCATE TABLE 'analytics_in_comscore.csv' ;
 4+TRUNCATE TABLE comscore ;
895 LOAD DATA LOCAL INFILE 'analytics_in_comscore.csv'
906 INTO TABLE comscore
917 FIELDS TERMINATED BY ','
@@ -103,14 +8,14 @@
1049 (@date,country_code,region_code,web_property,project_code,reach,visitors)
10510 SET date = last_day (str_to_date(concat (@date,'-01'),'%Y-%m-%d')) ;
10611
107 -TRUNCATE TABLE 'analytics_in_comscore_regions.csv' ;
 12+TRUNCATE TABLE comscore_regions ;
10813 LOAD DATA LOCAL INFILE 'analytics_in_comscore_regions.csv'
10914 INTO TABLE comscore_regions
11015 FIELDS TERMINATED BY ','
11116 OPTIONALLY ENCLOSED BY '"'
11217 (report_language,region_code,region_name) ;
11318
114 -TRUNCATE TABLE 'analytics_in_wikistats.csv' ;
 19+TRUNCATE TABLE wikistats ;
11520 LOAD DATA LOCAL INFILE 'analytics_in_wikistats.csv'
11621 INTO TABLE wikistats
11722 FIELDS TERMINATED BY ','
@@ -118,7 +23,7 @@
11924 (project_code,language_code,@date,editors_all_time,editors_new,editors_ge_5,editors_ge_25,editors_ge_100,articles,articles_new_per_day,articles_over_bytes_500,articles_over_bytes_2000,edits_per_article,bytes_per_article,edits,size_in_bytes,size_in_words,links_internal,links_interwiki,links_image,links_external,redirects)
12025 SET date = last_day (str_to_date(concat (@date,'-01'),'%Y-%m-%d')) ;
12126
122 -TRUNCATE TABLE 'analytics_in_page_views.csv' ;
 27+TRUNCATE TABLE page_views ;
12328 LOAD DATA LOCAL INFILE 'analytics_in_page_views.csv'
12429 INTO TABLE page_views
12530 FIELDS TERMINATED BY ','
@@ -126,15 +31,14 @@
12732 (project_code,language_code,@date,views_non_mobile_raw,views_mobile_raw,views_non_mobile_normalized,views_mobile_normalized,views_raw,views_normalized)
12833 SET date = last_day (str_to_date(concat (@date,'-01'),'%Y-%m-%d')) ;
12934
130 -
131 -TRUNCATE TABLE 'analytics_in_language_names.csv' ;
 35+TRUNCATE TABLE language_names ;
13236 LOAD DATA LOCAL INFILE 'analytics_in_language_names.csv'
13337 INTO TABLE language_names
13438 FIELDS TERMINATED BY ','
13539 OPTIONALLY ENCLOSED BY '"'
13640 (report_language,language_code,language_name) ;
13741
138 -TRUNCATE TABLE 'analytics_in_binaries.csv' ;
 42+TRUNCATE TABLE binaries ;
13943 LOAD DATA LOCAL INFILE 'analytics_in_binaries.csv'
14044 INTO TABLE binaries
14145 FIELDS TERMINATED BY ','
@@ -142,4 +46,10 @@
14347 (project_code,language_code,@date,extension,binaries)
14448 SET date = last_day (str_to_date(concat (@date,'-01'),'%Y-%m-%d')) ;
14549
146 -TRUNCATE TABLE 'analytics_in_offline.csv' ;
 50+TRUNCATE TABLE offline ;
 51+LOAD DATA LOCAL INFILE 'analytics_in_offline.csv'
 52+ INTO TABLE offline
 53+ FIELDS TERMINATED BY ','
 54+ OPTIONALLY ENCLOSED BY '"'
 55+ (@date, readers)
 56+ SET date = last_day (str_to_date(concat (@date,'-01'),'%Y-%m-%d')) ;

Status & tagging log