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