Datasets:
Download tasks/offline-compute/MySQL/mysql_018_en/init/init_db.sql from dicemy/DataClawEval: direct link, hf CLI and curl.
- Browser
- Download file 10.9 kB
-
https://huggingface.co/datasets/dicemy/DataClawEval/resolve/main/tasks/offline-compute/MySQL/mysql_018_en/init/init_db.sql
- Command line
-
hf download hf://datasets/dicemy/DataClawEval/tasks/offline-compute/MySQL/mysql_018_en/init/init_db.sql
-
curl -L -o init_db.sql https://huggingface.co/datasets/dicemy/DataClawEval/resolve/main/tasks/offline-compute/MySQL/mysql_018_en/init/init_db.sql
10.9 kB
| -- mysql_018 database initialization: create tables + load seed data | |
| -- Executed via: mysql -u root < init_db.sql | |
| -- Fix: MySQL root default auth_socket blocks pymysql TCP connections, | |
| -- switch to mysql_native_password so pymysql (Python) can connect. | |
| ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'root123'; | |
| FLUSH PRIVILEGES; | |
| CREATE DATABASE IF NOT EXISTS internal_platform_db | |
| DEFAULT CHARACTER SET utf8mb4 | |
| DEFAULT COLLATE utf8mb4_unicode_ci; | |
| USE internal_platform_db; | |
| -- Input table: URL safety detection detail | |
| CREATE TABLE IF NOT EXISTS t_dws_urlsafe_rela_mobile_browser_taid_url_di_mysql_018 ( | |
| taid VARCHAR(256) NOT NULL COMMENT '终端ID', | |
| url VARCHAR(256) NOT NULL COMMENT '访问URL', | |
| cgi VARCHAR(256) NOT NULL COMMENT 'URL对应的cgi', | |
| site VARCHAR(256) NOT NULL COMMENT 'URL对应的site', | |
| domain VARCHAR(256) NOT NULL COMMENT 'URL对应的domain', | |
| urltype INT DEFAULT NULL COMMENT 'URL安全类型', | |
| evilclass INT DEFAULT NULL COMMENT 'URL恶意大类', | |
| eviltype INT DEFAULT NULL COMMENT 'URL恶意类型', | |
| evillevel INT DEFAULT NULL COMMENT 'URL黑白等级', | |
| first_query_time VARCHAR(256) DEFAULT NULL COMMENT '首次查询时间', | |
| last_query_time VARCHAR(256) DEFAULT NULL COMMENT '末次查询时间', | |
| query_times_day BIGINT DEFAULT NULL COMMENT '查询次数', | |
| client_ip VARCHAR(256) DEFAULT NULL COMMENT '末次云查IP', | |
| device_ua VARCHAR(256) DEFAULT NULL COMMENT '设备机型', | |
| ds BIGINT NOT NULL COMMENT '日期分区(YYYYMMDD)' | |
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; | |
| -- Output table: URL access statistics report | |
| -- In Hive this was PARTITIONED BY (ds BIGINT, channel STRING), in MySQL we use regular columns | |
| CREATE TABLE IF NOT EXISTS t_app_urlsafe_report_url_access_stat_di_mysql_018 ( | |
| access_type VARCHAR(256) DEFAULT NULL COMMENT '访问类型', | |
| access_channel VARCHAR(256) DEFAULT NULL COMMENT '访问渠道', | |
| uv_1d BIGINT DEFAULT NULL COMMENT '1日UV', | |
| uv_avg_7d BIGINT DEFAULT NULL COMMENT '7日平均UV', | |
| uv_7d BIGINT DEFAULT NULL COMMENT '7日UV', | |
| uv_30d BIGINT DEFAULT NULL COMMENT '30日UV', | |
| uv_1m BIGINT DEFAULT NULL COMMENT '1月UV', | |
| userid_url_1d BIGINT DEFAULT NULL COMMENT 'URL维度1日用户数', | |
| userid_url_avg_7d BIGINT DEFAULT NULL COMMENT 'URL维度7日平均用户数', | |
| userid_url_7d BIGINT DEFAULT NULL COMMENT 'URL维度7日用户数', | |
| userid_url_30d BIGINT DEFAULT NULL COMMENT 'URL维度30日用户数', | |
| userid_url_1m BIGINT DEFAULT NULL COMMENT 'URL维度1月用户数', | |
| userid_domain_1d BIGINT DEFAULT NULL COMMENT '域名维度1日用户数', | |
| userid_domain_avg_7d BIGINT DEFAULT NULL COMMENT '域名维度7日平均用户数', | |
| userid_domain_7d BIGINT DEFAULT NULL COMMENT '域名维度7日用户数', | |
| userid_domain_30d BIGINT DEFAULT NULL COMMENT '域名维度30日用户数', | |
| userid_domain_1m BIGINT DEFAULT NULL COMMENT '域名维度1月用户数', | |
| userid_site_1d BIGINT DEFAULT NULL COMMENT '站点维度1日用户数', | |
| userid_site_avg_7d BIGINT DEFAULT NULL COMMENT '站点维度7日平均用户数', | |
| userid_site_7d BIGINT DEFAULT NULL COMMENT '站点维度7日用户数', | |
| userid_site_30d BIGINT DEFAULT NULL COMMENT '站点维度30日用户数', | |
| userid_site_1m BIGINT DEFAULT NULL COMMENT '站点维度1月用户数', | |
| userid_cgi_1d BIGINT DEFAULT NULL COMMENT 'CGI维度1日用户数', | |
| userid_cgi_avg_7d BIGINT DEFAULT NULL COMMENT 'CGI维度7日平均用户数', | |
| userid_cgi_7d BIGINT DEFAULT NULL COMMENT 'CGI维度7日用户数', | |
| userid_cgi_30d BIGINT DEFAULT NULL COMMENT 'CGI维度30日用户数', | |
| userid_cgi_1m BIGINT DEFAULT NULL COMMENT 'CGI维度1月用户数', | |
| ds BIGINT DEFAULT NULL COMMENT '日期分区', | |
| channel VARCHAR(256) DEFAULT NULL COMMENT '渠道分区' | |
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; | |
| -- Candidate output table (for agent to write into) | |
| CREATE TABLE IF NOT EXISTS t_app_urlsafe_report_url_access_stat_di_cand_mysql_018 ( | |
| access_type VARCHAR(256) DEFAULT NULL COMMENT '访问类型', | |
| access_channel VARCHAR(256) DEFAULT NULL COMMENT '访问渠道', | |
| uv_1d BIGINT DEFAULT NULL COMMENT '1日UV', | |
| uv_avg_7d BIGINT DEFAULT NULL COMMENT '7日平均UV', | |
| uv_7d BIGINT DEFAULT NULL COMMENT '7日UV', | |
| uv_30d BIGINT DEFAULT NULL COMMENT '30日UV', | |
| uv_1m BIGINT DEFAULT NULL COMMENT '1月UV', | |
| userid_url_1d BIGINT DEFAULT NULL COMMENT 'URL维度1日用户数', | |
| userid_url_avg_7d BIGINT DEFAULT NULL COMMENT 'URL维度7日平均用户数', | |
| userid_url_7d BIGINT DEFAULT NULL COMMENT 'URL维度7日用户数', | |
| userid_url_30d BIGINT DEFAULT NULL COMMENT 'URL维度30日用户数', | |
| userid_url_1m BIGINT DEFAULT NULL COMMENT 'URL维度1月用户数', | |
| userid_domain_1d BIGINT DEFAULT NULL COMMENT '域名维度1日用户数', | |
| userid_domain_avg_7d BIGINT DEFAULT NULL COMMENT '域名维度7日平均用户数', | |
| userid_domain_7d BIGINT DEFAULT NULL COMMENT '域名维度7日用户数', | |
| userid_domain_30d BIGINT DEFAULT NULL COMMENT '域名维度30日用户数', | |
| userid_domain_1m BIGINT DEFAULT NULL COMMENT '域名维度1月用户数', | |
| userid_site_1d BIGINT DEFAULT NULL COMMENT '站点维度1日用户数', | |
| userid_site_avg_7d BIGINT DEFAULT NULL COMMENT '站点维度7日平均用户数', | |
| userid_site_7d BIGINT DEFAULT NULL COMMENT '站点维度7日用户数', | |
| userid_site_30d BIGINT DEFAULT NULL COMMENT '站点维度30日用户数', | |
| userid_site_1m BIGINT DEFAULT NULL COMMENT '站点维度1月用户数', | |
| userid_cgi_1d BIGINT DEFAULT NULL COMMENT 'CGI维度1日用户数', | |
| userid_cgi_avg_7d BIGINT DEFAULT NULL COMMENT 'CGI维度7日平均用户数', | |
| userid_cgi_7d BIGINT DEFAULT NULL COMMENT 'CGI维度7日用户数', | |
| userid_cgi_30d BIGINT DEFAULT NULL COMMENT 'CGI维度30日用户数', | |
| userid_cgi_1m BIGINT DEFAULT NULL COMMENT 'CGI维度1月用户数', | |
| ds BIGINT DEFAULT NULL COMMENT '日期分区', | |
| channel VARCHAR(256) DEFAULT NULL COMMENT '渠道分区' | |
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; | |
| -- Seed data for input table: 10 rows | |
| INSERT INTO t_dws_urlsafe_rela_mobile_browser_taid_url_di_mysql_018 | |
| (taid, url, cgi, site, domain, urltype, evilclass, eviltype, evillevel, first_query_time, last_query_time, query_times_day, client_ip, device_ua, ds) | |
| VALUES | |
| ('taid001','http://a.com/p1','cgi1','site1','domain1.com',1,0,0,0,'2026-05-10','2026-06-08',10,'1.1.1.1','iPhone',20260608), | |
| ('taid001','http://a.com/p2','cgi2','site2','domain1.com',1,0,0,0,'2026-05-10','2026-06-07',5,'1.1.1.1','iPhone',20260607), | |
| ('taid001','http://b.com/p1','cgi3','site3','domain2.com',1,0,0,0,'2026-05-10','2026-06-06',3,'1.1.1.1','iPhone',20260606), | |
| ('taid002','http://c.com/p1','cgi1','site1','domain3.com',1,0,0,0,'2026-05-15','2026-06-08',8,'2.2.2.2','Android',20260608), | |
| ('taid002','http://c.com/p2','cgi2','site4','domain3.com',1,0,0,0,'2026-05-15','2026-06-05',4,'2.2.2.2','Android',20260605), | |
| ('taid003','http://d.com/p1','cgi4','site5','domain4.com',1,0,0,0,'2026-05-20','2026-06-08',12,'3.3.3.3','PhoneBrandH',20260608), | |
| ('taid003','http://d.com/p2','cgi4','site5','domain4.com',1,0,0,0,'2026-05-20','2026-06-03',2,'3.3.3.3','PhoneBrandH',20260603), | |
| ('taid004','http://e.com/p1','cgi5','site6','domain5.com',1,0,0,0,'2026-05-25','2026-06-02',1,'4.4.4.4','Sad_platformung',20260602), | |
| ('taid004','http://e.com/p2','cgi5','site7','domain5.com',1,0,0,0,'2026-05-25','2026-05-30',1,'4.4.4.4','Sad_platformung',20260530), | |
| ('taid005','http://f.com/p1','cgi6','site8','domain6.com',1,0,0,0,'2026-06-01','2026-06-04',6,'5.5.5.5','PhoneBrandX',20260604), | |
| -- 正例 (domain MAX-per-site attribution): taid006 has siteA with two domains | |
| -- {aaa.com, zzz.com} and siteB with {zzz.com}. Correct rule = MAX(domain): | |
| -- siteA->zzz.com, siteB->zzz.com => taid006 rolls up to ONE domain (zzz.com). | |
| -- If the rule were MIN(domain): siteA->aaa.com, siteB->zzz.com => TWO domains. | |
| -- This makes the MAX-vs-MIN choice change userid_domain_30d (grouping count). | |
| ('taid006','http://g.com/p1','cgi7','siteA','aaa.com',1,0,0,0,'2026-06-01','2026-06-08',5,'6.6.6.6','Oppo',20260608), | |
| ('taid006','http://g.com/p2','cgi7','siteA','zzz.com',1,0,0,0,'2026-06-01','2026-06-08',4,'6.6.6.6','Oppo',20260608), | |
| ('taid006','http://g.com/p3','cgi8','siteB','zzz.com',1,0,0,0,'2026-06-01','2026-06-08',3,'6.6.6.6','Oppo',20260608), | |
| -- 诱饵 (ds-window lower bound, ds > 20260509): ds=20260509 must be EXCLUDED. | |
| -- Uses brand-new url/cgi/site/domain so if the lower bound is dropped these | |
| -- distinct values leak into the url/cgi/domain/site counts (=> detectable). | |
| ('taid001','http://a.com/old','cgiOld','siteOld','old-domain.com',1,0,0,0,'2026-05-09','2026-05-09',1,'1.1.1.1','iPhone',20260509), | |
| -- 诱饵 (ds-window upper bound, ds <= 20260608): ds=20260609 must be EXCLUDED. | |
| ('taid001','http://a.com/future','cgiFut','siteFut','future-domain.com',1,0,0,0,'2026-06-09','2026-06-09',1,'1.1.1.1','iPhone',20260609); | |
| -- Seed data for output table historical partition: ds=20260531, channel='mobile_browser' | |
| -- This serves as the left-join source for 1m metrics | |
| INSERT INTO t_app_urlsafe_report_url_access_stat_di_mysql_018 | |
| (access_type, access_channel, uv_1d, uv_avg_7d, uv_7d, uv_30d, uv_1m, userid_url_1d, userid_url_avg_7d, userid_url_7d, userid_url_30d, userid_url_1m, userid_domain_1d, userid_domain_avg_7d, userid_domain_7d, userid_domain_30d, userid_domain_1m, userid_site_1d, userid_site_avg_7d, userid_site_7d, userid_site_30d, userid_site_1m, userid_cgi_1d, userid_cgi_avg_7d, userid_cgi_7d, userid_cgi_30d, userid_cgi_1m, ds, channel) | |
| VALUES | |
| ('网址检测API','手机IM平台Q浏览器',100,95,700,3000,2800,200,180,1400,6000,5500,50,45,350,1500,1400,80,75,560,2400,2200,60,55,420,1800,1700,20260531,'mobile_browser'); | |