提交 eb464464 编写于 作者: M Mars Liu

keywords override

上级 bbee7577
{ {
"node_id": "pg-11d131b2d01b40be90b23f096d4852cc", "node_id": "pg-11d131b2d01b40be90b23f096d4852cc",
"keywords": [], "keywords": ["关系型数据库", "database", "relational", "rdbms"],
"children": [], "children": [],
"export": [ "export": [
"relation.json" "relation.json"
......
{ {
"node_id": "pg-cf0e5cb243a247e2a0b812c5798cdba4", "node_id": "pg-cf0e5cb243a247e2a0b812c5798cdba4",
"keywords": [], "keywords": ["server", "client", "数据库服务器", "数据库客户端"],
"children": [], "children": [],
"export": [ "export": [
"client.json", "client.json",
......
{ {
"node_id": "pg-940afa6d71af44f689011ded8fd91a98", "node_id": "pg-940afa6d71af44f689011ded8fd91a98",
"keywords": [], "keywords": ["安装", "PostgreSQL"],
"children": [], "children": [],
"export": ["install.json"] "export": ["install.json"]
} }
\ No newline at end of file
{ {
"node_id": "pg-ee5c6d4a073b45a7995ba351ab9de46e", "node_id": "pg-ee5c6d4a073b45a7995ba351ab9de46e",
"keywords": [], "keywords": ["sql", "psql", " 数据库客户端"],
"children": [], "children": [],
"export": ["psql.json"] "export": ["psql.json"]
} }
\ No newline at end of file
{ {
"node_id": "pg-806d3976e8764d4f8e26c197c53d45a8", "node_id": "pg-806d3976e8764d4f8e26c197c53d45a8",
"keywords": [], "keywords": ["表", "table"],
"children": [], "children": [],
"export": [ "export": [
"table.json", "table.json",
......
{ {
"node_id": "pg-f371b91ef63a4ce08f80b92bc8580196", "node_id": "pg-f371b91ef63a4ce08f80b92bc8580196",
"keywords": [], "keywords": ["函数", "function"],
"children": [], "children": [],
"export": ["function.json"] "export": ["function.json"]
} }
\ No newline at end of file
{ {
"node_id": "pg-cb942198b3a84d5398d73d558a241543", "node_id": "pg-cb942198b3a84d5398d73d558a241543",
"keywords": [], "keywords": ["role", "login", "user", "用户", "角色", "权限", "privilege"],
"children": [], "children": [],
"export": [ "export": [
"grant.json", "grant.json",
......
{ {
"node_id": "pg-a0cb78d68d814f5e935b41922b88e085", "node_id": "pg-a0cb78d68d814f5e935b41922b88e085",
"keywords": [], "keywords": ["trigger", "触发器"],
"children": [], "children": [],
"export": ["trigger.json"] "export": ["trigger.json"]
} }
\ No newline at end of file
{ {
"node_id": "pg-d2b6e840cfad44a2aa357cfee56d437d", "node_id": "pg-d2b6e840cfad44a2aa357cfee56d437d",
"keywords": [], "keywords": ["数据库扩展", "数据库插件", "extension"],
"children": [], "children": [],
"export": [] "export": []
} }
\ No newline at end of file
{ {
"node_id": "pg-3a87b0dbead643e58f1ff1d93acd80cc", "node_id": "pg-3a87b0dbead643e58f1ff1d93acd80cc",
"keywords": [], "keywords": ["group by", "分组"],
"children": [], "children": [],
"export": [] "export": []
} }
\ No newline at end of file
{ {
"node_id": "pg-458d5d590ea64188847b45d8e6343f83", "node_id": "pg-458d5d590ea64188847b45d8e6343f83",
"keywords": [], "keywords": ["join", "连接查询"],
"children": [], "children": [],
"export": [] "export": []
} }
\ No newline at end of file
{ {
"node_id": "pg-55fd213f919d411c9b572241c4bb7807", "node_id": "pg-55fd213f919d411c9b572241c4bb7807",
"keywords": [], "keywords": ["子查询", "subquery"],
"children": [], "children": [],
"export": [ "export": [
"subquery.json" "subquery.json"
......
{ {
"node_id": "pg-69d3a1c646004e1da497fed2af57806c", "node_id": "pg-69d3a1c646004e1da497fed2af57806c",
"keywords": [], "keywords": ["分页", "limit", "offset"],
"children": [], "children": [],
"export": ["paged.json"] "export": ["paged.json"]
} }
\ No newline at end of file
{ {
"node_id": "pg-6beb084543204f4f9d87930c0a6c5707", "node_id": "pg-6beb084543204f4f9d87930c0a6c5707",
"keywords": [], "keywords": ["common table expression", "cte", "recursive"],
"children": [], "children": [],
"export": [] "export": []
} }
\ No newline at end of file
{ {
"node_id": "pg-eb4048b7dfd3469f8049330ba78427b5", "node_id": "pg-eb4048b7dfd3469f8049330ba78427b5",
"keywords": [], "keywords": ["plsql", "过程化"],
"children": [], "children": [],
"export": ["loop.json"] "export": ["loop.json"]
} }
\ No newline at end of file
{ {
"node_id": "pg-58e924e93b564a24abb1e6b9cdfbc094", "node_id": "pg-58e924e93b564a24abb1e6b9cdfbc094",
"keywords": [], "keywords": ["standby", "热备份", "高可用", "流复制"],
"children": [], "children": [],
"export": [ "export": [
"standby.json", "standby.json",
......
{ {
"node_id": "pg-7eff3dcf68644c23bd89f2a2abe4fac6", "node_id": "pg-7eff3dcf68644c23bd89f2a2abe4fac6",
"keywords": [], "keywords": ["standby", "高可用", "流复制", "wal"],
"children": [], "children": [],
"export": ["stream.json"] "export": ["stream.json"]
} }
\ No newline at end of file
{ {
"node_id": "pg-20a433f6ae65429f9b1a7f17c751ac01", "node_id": "pg-20a433f6ae65429f9b1a7f17c751ac01",
"keywords": [], "keywords": ["外部数据连接", "fdw"],
"children": [], "children": [],
"export": [] "export": []
} }
\ No newline at end of file
{ {
"node_id": "pg-69ad784e39c044d7a115cfd124e49ef1", "node_id": "pg-69ad784e39c044d7a115cfd124e49ef1",
"keywords": [], "keywords": ["json", "jsonb"],
"children": [], "children": [],
"export": [ "export": [
"json.json", "json.json",
......
{ {
"node_id": "pg-6dbbb44b41d347b58075a9155dfb8356", "node_id": "pg-6dbbb44b41d347b58075a9155dfb8356",
"keywords": [], "keywords": ["函数", "过程", "function", "produce"],
"children": [], "children": [],
"export": ["distinct.json"] "export": ["distinct.json"]
} }
\ No newline at end of file
{ {
"node_id": "pg-532f8f84ea74493a9581e6bf720ebf78", "node_id": "pg-532f8f84ea74493a9581e6bf720ebf78",
"keywords": [], "keywords": ["视图", "view"],
"children": [], "children": [],
"export": ["view.json"] "export": ["view.json"]
} }
\ No newline at end of file
{ {
"node_id": "pg-2e691ed3a847424eb887b40aca750c4e", "node_id": "pg-2e691ed3a847424eb887b40aca750c4e",
"keywords": [], "keywords": ["cte", "递归查询", "recursive"],
"children": [], "children": [],
"export": [ "export": [
"continuous.json" "continuous.json"
......
{ {
"keywords": [], "keywords": ["函数", "function"],
"children": [], "children": [],
"node_id": "pg-cab66a558cda467eabd9587b5a8257bd", "node_id": "pg-cab66a558cda467eabd9587b5a8257bd",
"export": [ "export": [
......
{ {
"node_id": "pg-693a81467f444886a199bac681f238b8", "node_id": "pg-693a81467f444886a199bac681f238b8",
"keywords": [], "keywords": ["透视表", "交叉透视表", "pivot"],
"children": [], "children": [],
"export": ["pivot.json"] "export": ["pivot.json"]
} }
\ No newline at end of file
{ {
"node_id": "pg-6ce3520f7a67494a90378e7b194f8720", "node_id": "pg-6ce3520f7a67494a90378e7b194f8720",
"keywords": [], "keywords": ["conflict", "冲突", "唯一约束"],
"children": [], "children": [],
"export": ["score.json"] "export": ["score.json"]
} }
\ No newline at end of file
{ {
"node_id": "pg-2d547e778fc4453b84feb0a0c6341348", "node_id": "pg-2d547e778fc4453b84feb0a0c6341348",
"keywords": [], "keywords": ["事务", "transaction"],
"children": [], "children": [],
"export": ["transaction.json"] "export": ["transaction.json"]
} }
\ No newline at end of file
...@@ -16,14 +16,24 @@ ...@@ -16,14 +16,24 @@
{ {
"关系型数据库": { "关系型数据库": {
"node_id": "pg-11d131b2d01b40be90b23f096d4852cc", "node_id": "pg-11d131b2d01b40be90b23f096d4852cc",
"keywords": [], "keywords": [
"关系型数据库",
"database",
"relational",
"rdbms"
],
"children": [] "children": []
} }
}, },
{ {
"服务器和客户端": { "服务器和客户端": {
"node_id": "pg-cf0e5cb243a247e2a0b812c5798cdba4", "node_id": "pg-cf0e5cb243a247e2a0b812c5798cdba4",
"keywords": [], "keywords": [
"server",
"client",
"数据库服务器",
"数据库客户端"
],
"children": [] "children": []
} }
} }
...@@ -38,7 +48,10 @@ ...@@ -38,7 +48,10 @@
{ {
"安装PostgreSQL": { "安装PostgreSQL": {
"node_id": "pg-940afa6d71af44f689011ded8fd91a98", "node_id": "pg-940afa6d71af44f689011ded8fd91a98",
"keywords": [], "keywords": [
"安装",
"PostgreSQL"
],
"children": [] "children": []
} }
}, },
...@@ -74,7 +87,11 @@ ...@@ -74,7 +87,11 @@
{ {
"psql": { "psql": {
"node_id": "pg-ee5c6d4a073b45a7995ba351ab9de46e", "node_id": "pg-ee5c6d4a073b45a7995ba351ab9de46e",
"keywords": [], "keywords": [
"sql",
"psql",
" 数据库客户端"
],
"children": [] "children": []
} }
}, },
...@@ -119,42 +136,68 @@ ...@@ -119,42 +136,68 @@
{ {
"表": { "表": {
"node_id": "pg-806d3976e8764d4f8e26c197c53d45a8", "node_id": "pg-806d3976e8764d4f8e26c197c53d45a8",
"keywords": [], "keywords": [
"表",
"table"
],
"children": [] "children": []
} }
}, },
{ {
"函数": { "函数": {
"node_id": "pg-f371b91ef63a4ce08f80b92bc8580196", "node_id": "pg-f371b91ef63a4ce08f80b92bc8580196",
"keywords": [], "keywords": [
"函数",
"function"
],
"children": [] "children": []
} }
}, },
{ {
"用户和权限": { "用户和权限": {
"node_id": "pg-cb942198b3a84d5398d73d558a241543", "node_id": "pg-cb942198b3a84d5398d73d558a241543",
"keywords": [], "keywords": [
"role",
"login",
"user",
"用户",
"角色",
"权限",
"privilege"
],
"children": [] "children": []
} }
}, },
{ {
"索引和约束": { "索引和约束": {
"node_id": "pg-eeb777ca54434480a06bfe7fc5e7d3ca", "node_id": "pg-eeb777ca54434480a06bfe7fc5e7d3ca",
"keywords": [], "keywords": [
"索引",
" 约束",
"constraints",
"index"
],
"children": [] "children": []
} }
}, },
{ {
" 触发器": { " 触发器": {
"node_id": "pg-a0cb78d68d814f5e935b41922b88e085", "node_id": "pg-a0cb78d68d814f5e935b41922b88e085",
"keywords": [], "keywords": [
"trigger",
"触发器"
],
"children": [] "children": []
} }
}, },
{ {
"数据库扩展": { "数据库扩展": {
"node_id": "pg-d2b6e840cfad44a2aa357cfee56d437d", "node_id": "pg-d2b6e840cfad44a2aa357cfee56d437d",
"keywords": [], "keywords": [
"数据库扩展",
"数据库插件",
"extension"
],
"children": [] "children": []
} }
} }
...@@ -169,42 +212,62 @@ ...@@ -169,42 +212,62 @@
{ {
"聚合和分组": { "聚合和分组": {
"node_id": "pg-3a87b0dbead643e58f1ff1d93acd80cc", "node_id": "pg-3a87b0dbead643e58f1ff1d93acd80cc",
"keywords": [], "keywords": [
"group by",
"分组"
],
"children": [] "children": []
} }
}, },
{ {
"连接查询": { "连接查询": {
"node_id": "pg-458d5d590ea64188847b45d8e6343f83", "node_id": "pg-458d5d590ea64188847b45d8e6343f83",
"keywords": [], "keywords": [
"join",
"连接查询"
],
"children": [] "children": []
} }
}, },
{ {
"子查询": { "子查询": {
"node_id": "pg-55fd213f919d411c9b572241c4bb7807", "node_id": "pg-55fd213f919d411c9b572241c4bb7807",
"keywords": [], "keywords": [
"子查询",
"subquery"
],
"children": [] "children": []
} }
}, },
{ {
"分页查询": { "分页查询": {
"node_id": "pg-69d3a1c646004e1da497fed2af57806c", "node_id": "pg-69d3a1c646004e1da497fed2af57806c",
"keywords": [], "keywords": [
"分页",
"limit",
"offset"
],
"children": [] "children": []
} }
}, },
{ {
"CTE": { "CTE": {
"node_id": "pg-6beb084543204f4f9d87930c0a6c5707", "node_id": "pg-6beb084543204f4f9d87930c0a6c5707",
"keywords": [], "keywords": [
"common table expression",
"cte",
"recursive"
],
"children": [] "children": []
} }
}, },
{ {
"过程化编程": { "过程化编程": {
"node_id": "pg-eb4048b7dfd3469f8049330ba78427b5", "node_id": "pg-eb4048b7dfd3469f8049330ba78427b5",
"keywords": [], "keywords": [
"plsql",
"过程化"
],
"children": [] "children": []
} }
}, },
...@@ -238,21 +301,34 @@ ...@@ -238,21 +301,34 @@
{ {
"standby": { "standby": {
"node_id": "pg-58e924e93b564a24abb1e6b9cdfbc094", "node_id": "pg-58e924e93b564a24abb1e6b9cdfbc094",
"keywords": [], "keywords": [
"standby",
"热备份",
"高可用",
"流复制"
],
"children": [] "children": []
} }
}, },
{ {
"流式复制集群": { "流式复制集群": {
"node_id": "pg-7eff3dcf68644c23bd89f2a2abe4fac6", "node_id": "pg-7eff3dcf68644c23bd89f2a2abe4fac6",
"keywords": [], "keywords": [
"standby",
"高可用",
"流复制",
"wal"
],
"children": [] "children": []
} }
}, },
{ {
"fdw": { "fdw": {
"node_id": "pg-20a433f6ae65429f9b1a7f17c751ac01", "node_id": "pg-20a433f6ae65429f9b1a7f17c751ac01",
"keywords": [], "keywords": [
"外部数据连接",
"fdw"
],
"children": [] "children": []
} }
} }
...@@ -277,21 +353,32 @@ ...@@ -277,21 +353,32 @@
{ {
"JSON和JSONB": { "JSON和JSONB": {
"node_id": "pg-69ad784e39c044d7a115cfd124e49ef1", "node_id": "pg-69ad784e39c044d7a115cfd124e49ef1",
"keywords": [], "keywords": [
"json",
"jsonb"
],
"children": [] "children": []
} }
}, },
{ {
"函数": { "函数": {
"node_id": "pg-6dbbb44b41d347b58075a9155dfb8356", "node_id": "pg-6dbbb44b41d347b58075a9155dfb8356",
"keywords": [], "keywords": [
"函数",
"过程",
"function",
"produce"
],
"children": [] "children": []
} }
}, },
{ {
"视图": { "视图": {
"node_id": "pg-532f8f84ea74493a9581e6bf720ebf78", "node_id": "pg-532f8f84ea74493a9581e6bf720ebf78",
"keywords": [], "keywords": [
"视图",
"view"
],
"children": [] "children": []
} }
} }
...@@ -306,42 +393,65 @@ ...@@ -306,42 +393,65 @@
{ {
"递归查询": { "递归查询": {
"node_id": "pg-2e691ed3a847424eb887b40aca750c4e", "node_id": "pg-2e691ed3a847424eb887b40aca750c4e",
"keywords": [], "keywords": [
"cte",
"递归查询",
"recursive"
],
"children": [] "children": []
} }
}, },
{ {
"Window Function": { "Window Function": {
"node_id": "pg-cab66a558cda467eabd9587b5a8257bd", "node_id": "pg-cab66a558cda467eabd9587b5a8257bd",
"keywords": [], "keywords": [
"函数",
"function"
],
"children": [] "children": []
} }
}, },
{ {
"透视表 ": { "透视表 ": {
"node_id": "pg-693a81467f444886a199bac681f238b8", "node_id": "pg-693a81467f444886a199bac681f238b8",
"keywords": [], "keywords": [
"透视表",
"交叉透视表",
"pivot"
],
"children": [] "children": []
} }
}, },
{ {
"写入和冲突": { "写入和冲突": {
"node_id": "pg-6ce3520f7a67494a90378e7b194f8720", "node_id": "pg-6ce3520f7a67494a90378e7b194f8720",
"keywords": [], "keywords": [
"conflict",
"冲突",
"唯一约束"
],
"children": [] "children": []
} }
}, },
{ {
"事务": { "事务": {
"node_id": "pg-2d547e778fc4453b84feb0a0c6341348", "node_id": "pg-2d547e778fc4453b84feb0a0c6341348",
"keywords": [], "keywords": [
"事务",
"transaction"
],
"children": [] "children": []
} }
}, },
{ {
"索引和优化": { "索引和优化": {
"node_id": "pg-79fe660f35f4469481db38509343c2b7", "node_id": "pg-79fe660f35f4469481db38509343c2b7",
"keywords": [], "keywords": [
"索引",
"index",
"performance",
"优化"
],
"children": [] "children": []
} }
} }
......
...@@ -101,6 +101,7 @@ class TreeWalker: ...@@ -101,6 +101,7 @@ class TreeWalker:
section_title = list(section_node.keys())[0] section_title = list(section_node.keys())[0]
full_path = os.path.join(chapter_path, f"{index + 1}.{section_title}") full_path = os.path.join(chapter_path, f"{index + 1}.{section_title}")
if os.path.isdir(full_path): if os.path.isdir(full_path):
self.check_section_keywords(full_path)
self.ensure_exercises(full_path) self.ensure_exercises(full_path)
tree_path = os.path.join(self.root, "tree.json") tree_path = os.path.join(self.root, "tree.json")
...@@ -309,3 +310,9 @@ class TreeWalker: ...@@ -309,3 +310,9 @@ class TreeWalker:
dump_json(full_name, exercise, True, True) dump_json(full_name, exercise, True, True)
else: else:
id_set.add(exercise["exercise_id"]) id_set.add(exercise["exercise_id"])
def check_section_keywords(self, full_path):
config = self.ensure_section_config(full_path)
if not config.get("keywords", []):
self.logger.error(f"节点 [{full_path}] 的关键字为空,请修改配置文件写入关键字")
sys.exit(1)
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册