mirror of
https://github.com/fastapi/sqlmodel.git
synced 2025-08-14 17:41:37 +08:00
♻️ Refactor generate select template to isolate templated code to the minimum (#967)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:

committed by
GitHub

parent
d5cba6e358
commit
d165e4b5ad
@ -7,8 +7,10 @@ import black
|
||||
from jinja2 import Template
|
||||
from pydantic import BaseModel
|
||||
|
||||
template_path = Path(__file__).parent.parent / "sqlmodel/sql/expression.py.jinja2"
|
||||
destiny_path = Path(__file__).parent.parent / "sqlmodel/sql/expression.py"
|
||||
template_path = (
|
||||
Path(__file__).parent.parent / "sqlmodel/sql/_expression_select_gen.py.jinja2"
|
||||
)
|
||||
destiny_path = Path(__file__).parent.parent / "sqlmodel/sql/_expression_select_gen.py"
|
||||
|
||||
|
||||
number_of_types = 4
|
||||
@ -48,7 +50,7 @@ result = template.render(number_of_types=number_of_types, signatures=signatures)
|
||||
|
||||
result = (
|
||||
"# WARNING: do not modify this code, it is generated by "
|
||||
"expression.py.jinja2\n\n" + result
|
||||
"_expression_select_gen.py.jinja2\n\n" + result
|
||||
)
|
||||
|
||||
result = black.format_str(result, mode=black.Mode())
|
||||
|
Reference in New Issue
Block a user