Reputation: 31546
I am using slick 3.0 Streaming API against MySQL database. Can I read 1000 rows at a time (the table is very large). till the entire table has been read?
it will be kind if you could point me to a sample which does that.
I can see the streaming API documentation, but I guess that reads 1 row at a time.
I want to read 1000 rows at a time, write them somewhere and then read another 1000 till the entire table is done.
Upvotes: 1
Views: 662
Reputation: 3260
You're looking for paging. In slick you do this by dropping and taking.
query.drop(offset).take(pageSize)
This will add the limit and offset values to your query.
Here is the documentation which has some examples: http://slick.lightbend.com/doc/3.1.1/queries.html#sorting-and-filtering
Upvotes: 3