Skip to content

lazy_query example #298

@stepankuzmin

Description

@stepankuzmin

Hi there! I want to stream a large set of rows from a database. I didn't find any examples of lazy_query and tried to do it like this:

let query = format!("select row_to_json({1}) from {0}.{1}", schema, table);

let trans = conn.transaction().unwrap();
let stmt = trans.prepare(&query).unwrap();
let result = stmt.lazy_query(&trans, &[], 2);

for rows in result {
    println!("row: {:?}", rows);
}

I'm getting LazyRows { name: "s0p0", row_limit: 2, remaining_rows: 2, more_rows: true } as result. So how can I get rows from LazyRows?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions