Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

Commit bed79c9

Browse files
author
cuizhongyi
committed
'update-dict'
1 parent 60a18de commit bed79c9

2 files changed

Lines changed: 8 additions & 8 deletions

File tree

自动生成数据库表字典的markdown文本/data_dict_config.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ def run(self, table_str):
5353
# 打开文件,准备写入
5454
dict_file = open(file_path, 'a', encoding='UTF-8')
5555
dict_file.write('#### %s %s' % (table_name, table_comment))
56-
dict_file.write('\n | 字段名称 | 字段类型 | 默认值 | 字段注释 |')
57-
dict_file.write('\n | --- | --- | --- | --- |')
56+
dict_file.write('\n| 字段名称 | 字段类型 | 默认值 | 字段注释 |')
57+
dict_file.write('\n| --- | --- | --- | --- |')
5858
# 表结构查询
5959
field_str = "COLUMN_NAME,COLUMN_TYPE,COLUMN_DEFAULT,COLUMN_COMMENT from information_schema.COLUMNS"
6060
sql = "select %s where table_schema='%s' and table_name='%s'" % (field_str, self.db_name, table_name)
@@ -65,8 +65,8 @@ def run(self, table_str):
6565
column_type = field['COLUMN_TYPE']
6666
column_default = str(field['COLUMN_DEFAULT'])
6767
column_comment = field['COLUMN_COMMENT']
68-
info = ' | ' + column_name + ' | ' + column_type + ' | ' + column_default + ' | ' + column_comment + ' | '
69-
dict_file.write('\n ' + info)
68+
info = '| ' + column_name + ' | ' + column_type + ' | ' + column_default + ' | ' + column_comment + ' | '
69+
dict_file.write('\n' + info)
7070
# 关闭连接
7171
print('完成表%s的数据字典' % (table_name,))
7272
dict_file.close()

自动生成数据库表字典的markdown文本/data_dict_input.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ def run(self, table_str):
5353
# 打开文件,准备写入
5454
dict_file = open(file_path, 'a', encoding='UTF-8')
5555
dict_file.write('#### %s %s' % (table_name, table_comment))
56-
dict_file.write('\n | 字段名称 | 字段类型 | 默认值 | 字段注释 |')
57-
dict_file.write('\n | --- | --- | --- | --- |')
56+
dict_file.write('\n| 字段名称 | 字段类型 | 默认值 | 字段注释 |')
57+
dict_file.write('\n| --- | --- | --- | --- |')
5858
# 表结构查询
5959
field_str = "COLUMN_NAME,COLUMN_TYPE,COLUMN_DEFAULT,COLUMN_COMMENT from information_schema.COLUMNS"
6060
sql = "select %s where table_schema='%s' and table_name='%s'" % (field_str, self.db_name, table_name)
@@ -65,8 +65,8 @@ def run(self, table_str):
6565
column_type = field['COLUMN_TYPE']
6666
column_default = str(field['COLUMN_DEFAULT'])
6767
column_comment = field['COLUMN_COMMENT']
68-
info = ' | ' + column_name + ' | ' + column_type + ' | ' + column_default + ' | ' + column_comment + ' | '
69-
dict_file.write('\n ' + info)
68+
info = '| ' + column_name + ' | ' + column_type + ' | ' + column_default + ' | ' + column_comment + ' | '
69+
dict_file.write('\n' + info)
7070
# 关闭连接
7171
print('完成表%s的数据字典' % (table_name,))
7272
dict_file.close()

0 commit comments

Comments
 (0)