From 31a583bba4fd8d41bd3fa8d196f9b566acbfd347 Mon Sep 17 00:00:00 2001 From: Xavi Lee Date: Thu, 7 Dec 2023 14:45:02 +0800 Subject: [PATCH] chore: update config for more readable (#39) --- scripts/custom_config/py_config_example.py | 14 ++++++++++++++ scripts/{update_json => generate_json}/.gitignore | 0 .../generate_json_from_sql.py} | 1 + 3 files changed, 15 insertions(+) rename scripts/{update_json => generate_json}/.gitignore (100%) rename scripts/{update_json/update_json_from_sql.py => generate_json/generate_json_from_sql.py} (99%) diff --git a/scripts/custom_config/py_config_example.py b/scripts/custom_config/py_config_example.py index d8f2e74..6b54a7f 100644 --- a/scripts/custom_config/py_config_example.py +++ b/scripts/custom_config/py_config_example.py @@ -1,5 +1,6 @@ # you should copy it into py_config.py. +# 数据库信息 database = { "host": "127.0.0.1", "user": "root", @@ -8,11 +9,20 @@ "port": 3306, "charset": "utf-8" } + +# word 文档每页单词数量 per_num = 18 + +# 待处理文档 original_doc = "" + +# 已处理文档 updated_doc = "updated_doc.docx" + +# json 文件位置 jsonFile = "../../netem.json" +# 数据库表和实际使用的列名的映射 column_list = [ {"column_name": "序号", "table_column": "id"}, {"column_name": "词频", "table_column": "frequency"}, @@ -21,10 +31,14 @@ {"column_name": "异形词", "table_column": "variant"} ] +# 处理的数据库表名 table_name = "vocabulary" +# 单元格单行所能容纳最大字符数 max_length = -1 +# 已处理后的 json 文件名 updated_json_name = "netem.json" +# json 文件标题 table_name_in_json = "5530考研词汇词频排序表" diff --git a/scripts/update_json/.gitignore b/scripts/generate_json/.gitignore similarity index 100% rename from scripts/update_json/.gitignore rename to scripts/generate_json/.gitignore diff --git a/scripts/update_json/update_json_from_sql.py b/scripts/generate_json/generate_json_from_sql.py similarity index 99% rename from scripts/update_json/update_json_from_sql.py rename to scripts/generate_json/generate_json_from_sql.py index 4c67823..bbd2cba 100644 --- a/scripts/update_json/update_json_from_sql.py +++ b/scripts/generate_json/generate_json_from_sql.py @@ -12,6 +12,7 @@ password=py_config.database["password"], database=py_config.database["name"], ) + column_list = py_config.column_list # 2. 获取列名和表字段名的列表