Perhaps the reason is that sql=
parameter expects only the query to be executed, but when you use select(products)
the structure changes. Try formatting and the query itself seems wrong as seen in the output. The tables to be selected are not mentioned. Look at 'https://docs.sqlalchemy.org/en/20/core/metadata.html' on how to specify which tables to select.