Datasets:
File size: 18,097 Bytes
e8c001c | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 | -- mysql_019 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 1: dwd_knowledge_base_sensors_event_di (sensor events, simplified to GT-relevant columns)
CREATE TABLE IF NOT EXISTS dwd_knowledge_base_sensors_event_di_mysql_019 (
`event` VARCHAR(256) DEFAULT NULL,
`user_id` VARCHAR(256) DEFAULT NULL,
`distinct_id` VARCHAR(256) DEFAULT NULL,
`date` VARCHAR(256) DEFAULT NULL,
`time` VARCHAR(256) DEFAULT NULL,
`receive_time` VARCHAR(256) DEFAULT NULL,
`os` VARCHAR(256) DEFAULT NULL,
`appname` VARCHAR(256) DEFAULT NULL,
`ip` VARCHAR(256) DEFAULT NULL,
`track_signup_original_id` VARCHAR(256) DEFAULT NULL,
`group_id` VARCHAR(256) DEFAULT NULL,
`post_id` VARCHAR(256) DEFAULT NULL,
`show_groups` VARCHAR(256) DEFAULT NULL,
`author_nick` VARCHAR(256) DEFAULT NULL,
`source_page` VARCHAR(256) DEFAULT NULL,
`source_module` VARCHAR(256) DEFAULT NULL,
`operation_type` VARCHAR(256) DEFAULT NULL,
`platform_type` VARCHAR(256) DEFAULT NULL,
`target_type` VARCHAR(256) DEFAULT NULL,
`target_id` VARCHAR(256) DEFAULT NULL,
`year` VARCHAR(256) DEFAULT NULL,
`month` VARCHAR(256) DEFAULT NULL,
`day` VARCHAR(256) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
INSERT INTO dwd_knowledge_base_sensors_event_di_mysql_019
(`event`, `user_id`, `distinct_id`, `date`, `time`, `receive_time`, `os`, `appname`, `ip`,
`track_signup_original_id`, `group_id`, `post_id`, `show_groups`, `author_nick`,
`source_page`, `source_module`, `operation_type`, `platform_type`,
`target_type`, `target_id`, `year`, `month`, `day`)
VALUES
('postdetailview', 'u001', 'nick_a', '20260608', '2026-06-08 10:00:00', '2026-06-08 10:00:01', 'ios', 'knowledge_base', '192.168.1.1',
'track01', 'grp_code_1', '1001', '101', 'author_a',
'page1', 'mod1', 'op_type1', 'pc',
'target_t1', 'tid1', '2026', '06', '08'),
('postdigg', 'u002', 'nick_b', '20260608', '2026-06-08 11:00:00', '2026-06-08 11:00:01', 'android', 'knowledge_base', '10.0.0.1',
'track02', '102', '1002', NULL, 'author_b',
'page2', 'mod2', 'op_type2', 'android',
'target_t2', 'tid2', '2026', '06', '08'),
('postbooknowledge_baseark', 'u003', 'nick_c', '20260608', '2026-06-08 12:00:00', '2026-06-08 12:00:01', 'h5', 'knowledge_base', '172.16.0.1',
'track03', 'grp_code_1', '1001', '101', 'author_c',
'page3', 'mod3', 'op_type3', 'h5',
'target_t3', 'tid3', '2026', '06', '08'),
('commentsend', 'u004', 'nick_d', '20260608', '2026-06-08 13:00:00', '2026-06-08 13:00:01', 'windows', 'knowledge_base', '8.8.8.8',
'track04', '100', '1003', NULL, 'author_d',
'page4', 'mod4', 'op_type4', 'windows',
'target_t4', 'tid4', '2026', '06', '08'),
('postcomment', 'u005', 'nick_a', '20260608', '2026-06-08 14:00:00', '2026-06-08 14:00:01', 'ios', 'knowledge_base', '1.1.1.1',
'track05', 'grp_code_1', '1002', '102', 'author_e',
'page5', 'mod5', 'op_type5', 'ios',
'target_t5', 'tid5', '2026', '06', '08'),
-- 诱饵 (decoy): event NOT in whitelist; passes all other filters -> must be dropped by event whitelist
('pageview', 'u101', 'nick_x', '20260608', '2026-06-08 15:00:00', '2026-06-08 15:00:01', 'ios', 'knowledge_base', '2.2.2.2',
'track11', '101', '1001', '101', 'author_x',
'page6', 'mod6', 'op_type6', 'ios',
'target_t6', 'tid6', '2026', '06', '08'),
-- 诱饵 (decoy): group_id AND show_groups both NULL -> must be dropped by (group_id IS NOT NULL OR show_groups IS NOT NULL)
('postdigg', 'u102', 'nick_y', '20260608', '2026-06-08 16:00:00', '2026-06-08 16:00:01', 'android', 'knowledge_base', '3.3.3.3',
'track12', NULL, '1001', NULL, 'author_y',
'page7', 'mod7', 'op_type7', 'android',
'target_t7', 'tid7', '2026', '06', '08'),
-- 诱饵 (decoy): post_id empty string -> must be dropped by (post_id IS NOT NULL AND post_id != '')
('postbooknowledge_baseark', 'u103', 'nick_z', '20260608', '2026-06-08 17:00:00', '2026-06-08 17:00:01', 'h5', 'knowledge_base', '4.4.4.4',
'track13', '101', '', '101', 'author_z',
'page8', 'mod8', 'op_type8', 'h5',
'target_t8', 'tid8', '2026', '06', '08');
-- Input table 2: dwv_knowledge_base_groups_users_df
CREATE TABLE IF NOT EXISTS dwv_knowledge_base_groups_users_df_mysql_019 (
`id` BIGINT DEFAULT NULL,
`nick` VARCHAR(256) DEFAULT NULL,
`group_id` BIGINT DEFAULT NULL,
`role` VARCHAR(256) DEFAULT NULL,
`created` VARCHAR(256) DEFAULT NULL,
`enabled` BIGINT DEFAULT NULL,
`origin` VARCHAR(256) DEFAULT NULL,
`is_hidden` BIGINT DEFAULT NULL,
`group_order` BIGINT DEFAULT NULL,
`at_mobile_homepage` BIGINT DEFAULT NULL,
`year` VARCHAR(256) DEFAULT NULL,
`month` VARCHAR(256) DEFAULT NULL,
`day` VARCHAR(256) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
INSERT INTO dwv_knowledge_base_groups_users_df_mysql_019
(`id`, `nick`, `group_id`, `role`, `created`, `enabled`, `origin`, `is_hidden`, `group_order`, `at_mobile_homepage`, `year`, `month`, `day`)
VALUES
(1, 'nick_a', 101, 'member', '2025-01-01', 1, 'web', 0, 1, 0, '2026', '06', '08'),
(2, 'nick_b', 102, 'admin', '2025-02-01', 1, 'web', 0, 2, 0, '2026', '06', '08'),
(3, 'nick_c', 101, 'member', '2025-03-01', 0, 'web', 0, 3, 0, '2026', '06', '08'),
(4, 'nick_d', 103, 'member', '2025-04-01', 1, 'web', 0, 4, 0, '2026', '06', '08');
-- Input table 3: dwv_kb_posts_df
CREATE TABLE IF NOT EXISTS dwv_kb_posts_df_mysql_019 (
`id` BIGINT DEFAULT NULL,
`category_id` BIGINT DEFAULT NULL,
`title` VARCHAR(256) DEFAULT NULL,
`source` VARCHAR(256) DEFAULT NULL,
`summary` VARCHAR(256) DEFAULT NULL,
`created_by` VARCHAR(256) DEFAULT NULL,
`created` VARCHAR(256) DEFAULT NULL,
`modified_by` VARCHAR(256) DEFAULT NULL,
`modified` VARCHAR(256) DEFAULT NULL,
`read_count` BIGINT DEFAULT NULL,
`reply_count` BIGINT DEFAULT NULL,
`top` BIGINT DEFAULT NULL,
`essential` BIGINT DEFAULT NULL,
`type` VARCHAR(256) DEFAULT NULL,
`published` VARCHAR(256) DEFAULT NULL,
`post_status` VARCHAR(256) DEFAULT NULL,
`question_status` VARCHAR(256) DEFAULT NULL,
`to_expert` VARCHAR(256) DEFAULT NULL,
`score` VARCHAR(256) DEFAULT NULL,
`expiration` VARCHAR(256) DEFAULT NULL,
`authorship` VARCHAR(256) DEFAULT NULL,
`reward` VARCHAR(256) DEFAULT NULL,
`last_updated` VARCHAR(256) DEFAULT NULL,
`last_updated_by` VARCHAR(256) DEFAULT NULL,
`origin` VARCHAR(256) DEFAULT NULL,
`privacy` VARCHAR(256) DEFAULT NULL,
`guid` VARCHAR(256) DEFAULT NULL,
`digg_count` VARCHAR(256) DEFAULT NULL,
`booknowledge_baseark_count` VARCHAR(256) DEFAULT NULL,
`editor` VARCHAR(256) DEFAULT NULL,
`is_commentable` VARCHAR(256) DEFAULT NULL,
`downloadable` VARCHAR(256) DEFAULT NULL,
`short_title` VARCHAR(256) DEFAULT NULL,
`related_type` VARCHAR(256) DEFAULT NULL,
`related_id` VARCHAR(256) DEFAULT NULL,
`recommended` VARCHAR(256) DEFAULT NULL,
`intro` VARCHAR(256) DEFAULT NULL,
`has_video` VARCHAR(256) DEFAULT NULL,
`default_img` VARCHAR(256) DEFAULT NULL,
`feature_tags` VARCHAR(256) DEFAULT NULL,
`md_content` VARCHAR(256) DEFAULT NULL,
`reward_tip` VARCHAR(256) DEFAULT NULL,
`reward_count` VARCHAR(256) DEFAULT NULL,
`lead_words` VARCHAR(256) DEFAULT NULL,
`is_watermarked` VARCHAR(256) DEFAULT NULL,
`is_hidden` VARCHAR(256) DEFAULT NULL,
`last_published` VARCHAR(256) DEFAULT NULL,
`year` VARCHAR(256) DEFAULT NULL,
`month` VARCHAR(256) DEFAULT NULL,
`day` VARCHAR(256) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
INSERT INTO dwv_kb_posts_df_mysql_019
(`id`, `category_id`, `title`, `source`, `summary`, `created_by`, `created`, `modified_by`, `modified`,
`read_count`, `reply_count`, `top`, `essential`, `type`, `published`, `post_status`, `question_status`,
`to_expert`, `score`, `expiration`, `authorship`, `reward`, `last_updated`, `last_updated_by`,
`origin`, `privacy`, `guid`, `digg_count`, `booknowledge_baseark_count`, `editor`, `is_commentable`, `downloadable`,
`short_title`, `related_type`, `related_id`, `recommended`, `intro`, `has_video`, `default_img`,
`feature_tags`, `md_content`, `reward_tip`, `reward_count`, `lead_words`, `is_watermarked`,
`is_hidden`, `last_published`, `year`, `month`, `day`)
VALUES
(1001, 201, 'Post Title 1', 'web', 'summary1', 'user1', '2025-01-01', 'user1', '2025-06-01',
100, 10, 0, 0, 'article', 'yes', 'published', '', '', '', '', 'original', '', '2025-06-01', 'user1',
'web', 'public', 'guid1', '5', '3', 'md', 'yes', 'yes', '', '', '', 'yes', 'intro1', 'no',
'', '', '', '', '', '', 'no', 'no', '2025-06-01', '2026', '06', '08'),
(1002, 202, 'Post Title 2', 'app', 'summary2', 'user2', '2025-02-01', 'user2', '2025-06-02',
200, 20, 1, 1, 'question', 'yes', 'published', 'open', '', '', '', 'repost', '', '2025-06-02', 'user2',
'app', 'private', 'guid2', '10', '5', 'rich', 'yes', 'no', '', '', '', 'no', 'intro2', 'yes',
'', '', '', '', '', '', 'no', 'no', '2025-06-02', '2026', '06', '08'),
(1003, 201, 'Post Title 3', 'web', 'summary3', 'user3', '2025-03-01', 'user3', '2025-06-03',
50, 5, 0, 0, 'article', 'yes', 'published', '', '', '', '', 'original', '', '2025-06-03', 'user3',
'web', 'public', 'guid3', '2', '1', 'md', 'yes', 'yes', '', '', '', 'yes', 'intro3', 'no',
'', '', '', '', '', '', 'no', 'no', '2025-06-03', '2026', '06', '08');
-- Input table 4: dwv_kb_categories_df
CREATE TABLE IF NOT EXISTS dwv_kb_categories_df_mysql_019 (
`id` VARCHAR(256) DEFAULT NULL,
`cat_type` VARCHAR(256) DEFAULT NULL,
`cat_id` VARCHAR(256) DEFAULT NULL,
`node_type` VARCHAR(256) DEFAULT NULL,
`name` VARCHAR(256) DEFAULT NULL,
`code` VARCHAR(256) DEFAULT NULL,
`parent_id` VARCHAR(256) DEFAULT NULL,
`created_by` VARCHAR(256) DEFAULT NULL,
`created` VARCHAR(256) DEFAULT NULL,
`modified_by` VARCHAR(256) DEFAULT NULL,
`modified` VARCHAR(256) DEFAULT NULL,
`posts_count` VARCHAR(256) DEFAULT NULL,
`relate_id` VARCHAR(256) DEFAULT NULL,
`item_order` VARCHAR(256) DEFAULT NULL,
`lft` VARCHAR(256) DEFAULT NULL,
`rgt` VARCHAR(256) DEFAULT NULL,
`enabled` VARCHAR(256) DEFAULT NULL,
`articles_count` VARCHAR(256) DEFAULT NULL,
`files_count` VARCHAR(256) DEFAULT NULL,
`topics_count` VARCHAR(256) DEFAULT NULL,
`event_logches_count` VARCHAR(256) DEFAULT NULL,
`questions_count` VARCHAR(256) DEFAULT NULL,
`color` VARCHAR(256) DEFAULT NULL,
`access_level` VARCHAR(256) DEFAULT NULL,
`year` VARCHAR(256) DEFAULT NULL,
`month` VARCHAR(256) DEFAULT NULL,
`day` VARCHAR(256) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
INSERT INTO dwv_kb_categories_df_mysql_019
(`id`, `cat_type`, `cat_id`, `node_type`, `name`, `code`, `parent_id`, `created_by`, `created`,
`modified_by`, `modified`, `posts_count`, `relate_id`, `item_order`, `lft`, `rgt`, `enabled`,
`articles_count`, `files_count`, `topics_count`, `event_logches_count`, `questions_count`,
`color`, `access_level`, `year`, `month`, `day`)
VALUES
('201', 'post', 'c1', 'leaf', 'Tech Category', 'TC', '0', 'admin', '2024-01-01',
'admin', '2024-06-01', '50', '', '1', '1', '10', '1', '', '', '', '', '',
'blue', 'public', '2026', '06', '08'),
('202', 'post', 'c2', 'leaf', 'General Category', 'GC', '0', 'admin', '2024-01-01',
'admin', '2024-06-01', '30', '', '2', '11', '20', '1', '', '', '', '', '',
'green', 'public', '2026', '06', '08');
-- Input table 5: dwv_knowledge_base_groups_df
CREATE TABLE IF NOT EXISTS dwv_knowledge_base_groups_df_mysql_019 (
`id` VARCHAR(256) DEFAULT NULL,
`category_id` VARCHAR(256) DEFAULT NULL,
`name` VARCHAR(256) DEFAULT NULL,
`description` VARCHAR(256) DEFAULT NULL,
`code` VARCHAR(256) DEFAULT NULL,
`logo` VARCHAR(256) DEFAULT NULL,
`type` VARCHAR(256) DEFAULT NULL,
`status` VARCHAR(256) DEFAULT NULL,
`created_by` VARCHAR(256) DEFAULT NULL,
`created` VARCHAR(256) DEFAULT NULL,
`modified_by` VARCHAR(256) DEFAULT NULL,
`modified` VARCHAR(256) DEFAULT NULL,
`notice_level` VARCHAR(256) DEFAULT NULL,
`express` VARCHAR(256) DEFAULT NULL,
`bulletin` VARCHAR(256) DEFAULT NULL,
`preset_tags` VARCHAR(256) DEFAULT NULL,
`root_category_id` VARCHAR(256) DEFAULT NULL,
`access_level` VARCHAR(256) DEFAULT NULL,
`properties` VARCHAR(256) DEFAULT NULL,
`dept_id` VARCHAR(256) DEFAULT NULL,
`is_hot` VARCHAR(256) DEFAULT NULL,
`need_calendar` VARCHAR(256) DEFAULT NULL,
`need_journal` VARCHAR(256) DEFAULT NULL,
`need_platformw` VARCHAR(256) DEFAULT NULL,
`section_id` VARCHAR(256) DEFAULT NULL,
`score` VARCHAR(256) DEFAULT NULL,
`show_custom_banner` VARCHAR(256) DEFAULT NULL,
`banner` VARCHAR(256) DEFAULT NULL,
`need_video` VARCHAR(256) DEFAULT NULL,
`sync_virtual_group` VARCHAR(256) DEFAULT NULL,
`sync_partner` VARCHAR(256) DEFAULT NULL,
`sync_part_time_member` VARCHAR(256) DEFAULT NULL,
`is_public_dept` VARCHAR(256) DEFAULT NULL,
`year` VARCHAR(256) DEFAULT NULL,
`month` VARCHAR(256) DEFAULT NULL,
`day` VARCHAR(256) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
INSERT INTO dwv_knowledge_base_groups_df_mysql_019
(`id`, `category_id`, `name`, `description`, `code`, `logo`, `type`, `status`, `created_by`, `created`,
`modified_by`, `modified`, `notice_level`, `express`, `bulletin`, `preset_tags`, `root_category_id`,
`access_level`, `properties`, `dept_id`, `is_hot`, `need_calendar`, `need_journal`, `need_platformw`,
`section_id`, `score`, `show_custom_banner`, `banner`, `need_video`, `sync_virtual_group`,
`sync_partner`, `sync_part_time_member`, `is_public_dept`, `year`, `month`, `day`)
VALUES
('101', 'cat1', 'Group A', 'desc A', '101', '', 'open', 'active', 'admin', '2024-01-01',
'admin', '2024-06-01', '1', '', '', '', '', 'public', '', '', 'no', 'no', 'no', 'no',
'', '', 'no', '', 'no', 'no', 'no', 'no', 'no', '2026', '06', '08'),
('102', 'cat2', 'Group B', 'desc B', '102', '', 'closed', 'active', 'admin', '2024-02-01',
'admin', '2024-06-02', '2', '', '', '', '', 'private', '', '', 'no', 'no', 'no', 'no',
'', '', 'no', '', 'no', 'no', 'no', 'no', 'no', '2026', '06', '08'),
('103', 'cat3', 'Group C', 'desc C', '100', '', 'open', 'active', 'admin', '2024-03-01',
'admin', '2024-06-03', '1', '', '', '', '', 'public', '', '', 'no', 'no', 'no', 'no',
'', '', 'no', '', 'no', 'no', 'no', 'no', 'no', '2026', '06', '08');
-- Output table: dwd_knowledge_base_k_bar_posts_event_di (target for GT)
CREATE TABLE IF NOT EXISTS dwd_knowledge_base_k_bar_posts_event_di_cand_mysql_019 (
`event` VARCHAR(256) DEFAULT NULL,
`distinct_id` VARCHAR(256) DEFAULT NULL,
`appname` VARCHAR(256) DEFAULT NULL,
`user_id` VARCHAR(256) DEFAULT NULL,
`event_time` VARCHAR(256) DEFAULT NULL,
`receive_time` VARCHAR(256) DEFAULT NULL,
`os` VARCHAR(256) DEFAULT NULL,
`track_signup_original_id` VARCHAR(256) DEFAULT NULL,
`author_nick` VARCHAR(256) DEFAULT NULL,
`platform_type` VARCHAR(256) DEFAULT NULL,
`target_type` VARCHAR(256) DEFAULT NULL,
`target_id` VARCHAR(256) DEFAULT NULL,
`ip` VARCHAR(256) DEFAULT NULL,
`post_id` VARCHAR(256) DEFAULT NULL,
`show_groups` VARCHAR(256) DEFAULT NULL,
`group_id` VARCHAR(256) DEFAULT NULL,
`source_page` VARCHAR(256) DEFAULT NULL,
`source_module` VARCHAR(256) DEFAULT NULL,
`operation_type` VARCHAR(256) DEFAULT NULL,
`pc_or_mobile` VARCHAR(256) DEFAULT NULL,
`is_group_member` INT DEFAULT NULL,
`post_authorship` VARCHAR(256) DEFAULT NULL,
`posts_category_id` BIGINT DEFAULT NULL,
`posts_category_name` VARCHAR(256) DEFAULT NULL,
`year` VARCHAR(256) DEFAULT NULL,
`month` VARCHAR(256) DEFAULT NULL,
`day` VARCHAR(256) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|