bugfix
This commit is contained in:
parent
da8277b3b3
commit
a682d9d5b5
@ -17,5 +17,5 @@ install_requires =
|
|||||||
console_scripts =
|
console_scripts =
|
||||||
xls2ddl = xls2ddl.xls2ddl:main
|
xls2ddl = xls2ddl.xls2ddl:main
|
||||||
xls2ui = xls2ddl.xls2ui:main
|
xls2ui = xls2ddl.xls2ui:main
|
||||||
json2xlsx = xls2ddl.json2xlsx
|
json2xlsx = xls2ddl.json2xlsx:main
|
||||||
|
|
||||||
|
|||||||
@ -83,13 +83,12 @@ def save_table_json_to_xlsx(table_json, output_dir="."):
|
|||||||
# ======================
|
# ======================
|
||||||
# 使用示例
|
# 使用示例
|
||||||
# ======================
|
# ======================
|
||||||
|
def main():
|
||||||
if __name__ == "__main__":
|
|
||||||
import os, sys
|
import os, sys
|
||||||
import codecs
|
import codecs
|
||||||
import json
|
import json
|
||||||
if len(sys.argv) < 2:
|
if len(sys.argv) < 2:
|
||||||
print(f'{sys.argv[0] dbtable_json_file ...')
|
print(f'{sys.argv[0]} dbtable_json_file ...')
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
for a in sys.argv[1:]:
|
for a in sys.argv[1:]:
|
||||||
with open(a, 'r', encoding='utf-8') as file:
|
with open(a, 'r', encoding='utf-8') as file:
|
||||||
@ -99,6 +98,9 @@ if __name__ == "__main__":
|
|||||||
data = [data]
|
data = [data]
|
||||||
for d in data:
|
for d in data:
|
||||||
save_table_json_to_xlsx(d)
|
save_table_json_to_xlsx(d)
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
"""
|
"""
|
||||||
# 示例 JSON 数据
|
# 示例 JSON 数据
|
||||||
sample_json = {
|
sample_json = {
|
||||||
|
|||||||
@ -178,7 +178,7 @@ class CRUDData(XLSXData):
|
|||||||
if len(d['summary']) != 1:
|
if len(d['summary']) != 1:
|
||||||
raise CRUDException(self.xlsxfile, 'Not summary or more than one summary')
|
raise CRUDException(self.xlsxfile, 'Not summary or more than one summary')
|
||||||
self.convPrimary()
|
self.convPrimary()
|
||||||
self.convForeignkey()
|
# self.convForeignkey()
|
||||||
self.convIndex()
|
self.convIndex()
|
||||||
self.check_codes_fields()
|
self.check_codes_fields()
|
||||||
|
|
||||||
@ -251,7 +251,7 @@ class CRUDData(XLSXData):
|
|||||||
data = self.data
|
data = self.data
|
||||||
if data.get('indexes'):
|
if data.get('indexes'):
|
||||||
return
|
return
|
||||||
vs = data['validation']
|
vs = data.get('validation', [])
|
||||||
nvs = []
|
nvs = []
|
||||||
for v in vs:
|
for v in vs:
|
||||||
if v['oper'] == 'idx':
|
if v['oper'] == 'idx':
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user