commit fc91486 在新增模板中加了回查 SELECT:
SELECT * FROM tbl WHERE {{summary[0].pkey}} = ${id}$
但 model 的 summary 里主键字段叫 primary 不是 pkey,
Jinja2 取不到返回 None,渲染成 ${None}$,
sqlor 处理后变成 WHERE None = %s。
改为 {{summary[0].primary[0]}},取 primary 数组第一个元素。
xls2ddl
a tool to create related database schema from xlsx file
there is a xlsx template file called "model.xlst" in this repo
How to use it
1 double click "model.xlst" 2 in "sammary" datasheet, wirte the table name, table label, primary key 3 in "fields" datasheet, create all the field in the table 4 in "validation" datashhet identifies the index first column is index name second column choose the "idx" thrid column for duplicatable index use "index:f1,f2 ..." or "unique:f1, f2, ..." for unique index
5 save it with the tablenme as xlsx file's name 6 repeat 1 to 5 for all the table. 7 translates all xlsx file to ddl sql using in the folder hold all the xlsx file
for mysql
python path/to/xls2ddl.py mysql .
for sqlite3
python path/to/xls2ddl.py sqlite3 .
for oracle
python path/to/xls2ddl.py oracle .
for postgresql
python path/to/xls2ddl.py postgresql .
for sqlserver
python path/to/xls2ddl.py sqlserver .
examples xlsx file
open the examples.xlsx to find out how to write a table schema infomation
write your table schema info file:
1 copy examples.xlsx file to 'your table name'.xlsx 2 open 'your table name'.xlsx and change information in summary, fields, validation codes 3 save it 4 use xls2ddl translates xlsx file to ddl file 5 use the ddl file to create you database tables
xls2ui
xls2ui is a tool to create table data administration website user interface. it is only support ahserver backend server and bricks front end