Since I am using mysql, I would like to generate code that accepts multiple values using sqlc.slice.
Example
schema & query
create table students (
id int not null auto_increment,
name varchar(255) not null,
age int not null
);
-- name: SelectStudents :many
SELECT * FROM students
WHERE age IN (sqlc.slice("ages"));
current results:
class Querier:
def __init__(self, conn: sqlalchemy.engine.Connection):
self._conn = conn
def select_students(self, *, ages: int) -> Iterator[models.Student]:
result = self._conn.execute(sqlalchemy.text(SELECT_STUDENTS), {"p1": ages})
for row in result:
yield models.Student(
id=row[0],
name=row[1],
age=row[2],
)
i want:
class Querier:
def __init__(self, conn: sqlalchemy.engine.Connection):
self._conn = conn
def select_students(self, *, ages: list[int]) -> Iterator[models.Student]:
# some kind of processing
Since I am using mysql, I would like to generate code that accepts multiple values using sqlc.slice.
Example
schema & query
current results:
i want: