过节啦!TiDB 社区第五届 1024 程序员心愿节|参与活动即可获得 1024 定制款卫衣、毛毯、免费考证兑换券等丰富礼品!

【今年参与了哪些 TiDB 社区的线上 & 线下活动?对哪些活动的主题和 Talk 内容印象深刻?希望社区 2026 年举办什么样的活动?】
TEM 、TiCDC 试用
TiDB vs MySQL
TiDB vs SQLServer

希望 2026 讲些 数据向量 方面的活动。

【分享 PCTA/PCTP/PCSD 考证对你的工作/求职/TiDB 学习/运维的帮助,同时@一位由你邀请加入 TiDB 社区的新朋友】

PCTA/PCTP/PCSD 考证是一个系统化梳理 TiDB 知识体系的过程,帮助很大

【给 TiDB 社区小伙伴们送上有意义的代码祝福语吧!】

# ...existing code...
import json
from datetime import datetime

blessings = [
    {"id": 1, "category": "稳定",   "message": "愿 TiDB 事务 ACID 稳定,二阶段提交流畅无忧", "importance": 5, "created_at": datetime.now()},
    {"id": 2, "category": "性能",   "message": "愿每次查询都低延迟、高命中,慢查询成为历史",      "importance": 4, "created_at": datetime.now()},
    {"id": 3, "category": "可用性", "message": "愿 Leader 健康、Replica 一致,故障自动恢复迅速",      "importance": 5, "created_at": datetime.now()},
    {"id": 4, "category": "协作",   "message": "愿 PR 快速合入、review 建设性强、贡献者心情愉悦",       "importance": 3, "created_at": datetime.now()},
    {"id": 5, "category": "生态",   "message": "愿生态繁荣,插件、工具和文档日益完善",               "importance": 4, "created_at": datetime.now()},
]

# 按重要性降序、id 升序输出每条祝福及 JSON 元数据
for b in sorted(blessings, key=lambda x: (-x["importance"], x["id"])):
    meta = {"importance": b["importance"], "created_at": b["created_at"].strftime("%Y-%m-%d %H:%M:%S")}
    print(f'{b["id"]:>2} | {b["category"]:<6} | {b["message"]}')
    print("    meta:", json.dumps(meta, ensure_ascii=False))

# 生成摘要
summary = {
    "total_blessings": len(blessings),
    "max_importance": max(b["importance"] for b in blessings),
    "top_message": max(blessings, key=lambda x: x["importance"])["message"]
}
print("\n摘要:")
print(json.dumps(summary, ensure_ascii=False, indent=2))

# 汇总为一条串联的祝福
blessing_line = "1024 程序员节祝福 — TiDB 社区: " + "  |  ".join(
    [b["message"] for b in sorted(blessings, key=lambda x: (-x["importance"], x["id"]))]
)
print("\n" + blessing_line)
# ...existing code...