method insert of table/view should properly set the sqltype of the columns f the Value query
from querybuilder.schemas.helper import table
@table
class tbl:
x: str
y: int
iq = tbl.insert(tbl.columns, [(42, 42)])
print(iq.query.columns[0].sqltype)
print(str(iq))
- result:
int
INSERT INTO tbl (x, y) VALUES (42, 42)
- expected:
str
INSERT INTO tbl (x, y) VALUES (?, 42) -- ↖{0: 42}
Indeed, because tbl.columns.x
has sqltype str
, so should have the first column of each row (tuple
) of iq.query
.
Edited by Bruno Guillon