Skip to content

Instantly share code, notes, and snippets.

View mzhang77's full-sized avatar

Michael Zhang mzhang77

  • PingCAP
View GitHub Profile
mysql> show create table edges\G
*************************** 1. row ***************************
       Table: edges
Create Table: CREATE TABLE `edges` (
  `id` bigint NOT NULL AUTO_INCREMENT,
  `from_event_id` varchar(64) NOT NULL,
  `to_entity_id` varchar(64) NOT NULL,
  `to_entity_type` int NOT NULL,
  `from_event_type` int NOT NULL,
import mysql.connector
import random
import time
# ================= 配置区域 =================
DB_CONFIG = {
'host': '127.0.0.1', # 替换 TiDB IP
'port': 4000,
'user': 'root', # 替换用户名
'password': '', # 替换密码
mysql> show create table t\G
*************************** 1. row ***************************
Table: t
Create Table: CREATE TABLE `t` (
`id` int NOT NULL,
`a` int DEFAULT NULL,
`b` int DEFAULT NULL,
`c` int DEFAULT NULL,
`padding` varchar(100) DEFAULT NULL,
PRIMARY KEY (`id`) /*T![clustered_index] CLUSTERED */,
import pymysql
import random
import time
# --- 数据库配置 ---
DB_CONFIG = {
'host': '127.0.0.1', # 默认为本地,如果 TiDB 在远程请修改 IP
'port': 4000,
'user': 'root',
mysql> show create table audit_log_events\G
*************************** 1. row ***************************
Table: audit_log_events
Create Table: CREATE TABLE `audit_log_events` (
`id` bigint unsigned NOT NULL AUTO_INCREMENT,
`event_uuid` varbinary(16) NOT NULL,
`created_at` timestamp(6) NOT NULL,
`user_uuid` binary(16) DEFAULT NULL,
`source_hash` binary(64) DEFAULT NULL,
`device_code` varchar(32) DEFAULT NULL,
import pymysql
import random
import time
import binascii
from datetime import datetime, timedelta
# --- Database Configuration ---
DB_CONFIG = {
'host': '127.0.0.1',
'port': 4000,
package main
import (
"crypto/rand"
"database/sql"
"encoding/hex"
"fmt"
"log"
"os"
"strconv"
import threading
import mysql.connector
from mysql.connector import Error
import random
import string
import time
from datetime import datetime, timedelta
from collections import Counter
import logging
from logging.handlers import RotatingFileHandler
#!/usr/bin/env python3
config="""
[data-sources]
[data-sources.mysql]
host = "127.0.0.1"
port = 3306
user = "root"
password = ""
import random
import string
import datetime
import mysql.connector
import time
def random_string(length=10):
return ''.join(random.choices(string.ascii_lowercase + string.digits, k=length))
def random_date(start_year=2000, end_year=2025):