Open proofit404 opened 3 days ago
https://mypy.readthedocs.io/en/stable/command_line.html#enabling-incomplete-experimental-features
class UsersAboveAge(Sql[{"age": UserAge}, Users]):
query = """
SELECT "id", "name", "age" FROM "users" WHERE "age" > {{ age }};
"""
Since select statement fields should match result dictionary type, we could generate part of the query.
class UsersAboveAge(Sql[{"age": UserAge}, Users]):
query = """
SELECT {{ fields }} FROM "users" WHERE "age" > {{ age }};
"""
In that case if we change User signature with additional fields, all of them would be automatically added to the query.