43 lines
845 B
Cheetah
43 lines
845 B
Cheetah
$GENERATED_PYTHON_COMMENT
|
|
|
|
from db import dbGetMany, dbGetOne
|
|
|
|
#for $table in $tables
|
|
def get_${table.name}s(user, token_info):
|
|
return dbGetMany(user, token_info, {
|
|
"statement": """
|
|
SELECT
|
|
id
|
|
#for $column in $table.columns
|
|
,$column.name
|
|
#end for
|
|
FROM ${table.name}_t
|
|
#if $table.selectors
|
|
ORDER BY
|
|
#set $sep = ""
|
|
#for $selector in $table.selectors
|
|
$sep$selector
|
|
#set $sep = ","
|
|
#end for
|
|
#end if
|
|
""",
|
|
"params": ()
|
|
}
|
|
)
|
|
|
|
def get_${table.name}(user, token_info, ${table.name}Id=None):
|
|
return dbGetOne(user, token_info, {
|
|
"statement": """
|
|
SELECT
|
|
id
|
|
#for $column in $table.columns
|
|
,$column.name
|
|
#end for
|
|
FROM ${table.name}_t
|
|
WHERE id = %s
|
|
""",
|
|
"params": (${table.name}Id, )
|
|
}
|
|
)
|
|
#end for
|