seancorfield / next-jdbc

A modern low-level Clojure wrapper for JDBC-based access to databases.
https://cljdoc.org/d/com.github.seancorfield/next.jdbc/
Eclipse Public License 1.0
750 stars 89 forks source link

Example using cursors and fetch-size #261

Closed sirmspencer closed 9 months ago

sirmspencer commented 9 months ago

Is your feature request related to a problem? Please describe. Is there a way to read from the db in lazy way like https://funcool.github.io/clojure.jdbc/latest/#cursor-queries? I see fetch size and cursor but its not obvious to me how to implement that.

Describe the solution you'd like An update to the docs to show a full example

Describe alternatives you've considered Use funcool

seancorfield commented 9 months ago

This page in the docs explains the options needed for some databases to stream results: https://cljdoc.org/d/com.github.seancorfield/next.jdbc/1.3.894/doc/getting-started/tips-tricks

(and you'll want to reduce over plan to make this work, as explained elsewhere in the docs regarding not materializing the entire result set)

It's different for every database (of course).

If that is not sufficient, please explain what you think is missing.

sirmspencer commented 9 months ago

Never mind, I see it now. My search terms were off and was only seeing the settings page.

seancorfield commented 9 months ago

reduce over plan is covered in Getting Started: https://cljdoc.org/d/com.github.seancorfield/next.jdbc/1.3.894/doc/getting-started#plan--reducing-result-sets

Streaming data with plan is covered in Tips & Tricks: https://cljdoc.org/d/com.github.seancorfield/next.jdbc/1.3.894/doc/getting-started/tips-tricks#reducing-and-folding-with-plan (further up the page from the link I provided earlier)