Fork me on GitHub
#sql
<
2021-07-06
>
jmckitrick20:07:35

Hi all, I'm trying to understand some behavior of next.jdbc. My colleague and I are streaming data to REST endpoints, and both of us were able to get it working without calling datafiable-row on the result set row. Yet in production, this fails, and datafiable-row fixes the issue. Why is this? I understand why this call is needed, but how would streaming work without it?

jmckitrick20:07:12

In other words: 'How did this ever work?' 🙂

seancorfield20:07:16

@jmckitrick I suspect your dev dataset is smaller than your prod dataset? So in dev you probably got the whole result set in the first "streaming block" (fetch) and so closing the result set still allowed for the in-memory data to be produced. In production, you ended up closing the result set before all the data had been processed.

seancorfield20:07:39

It may also depend on whether you're using the same database/drivers in dev/prod too.

jmckitrick20:07:17

Ah, that makes sense! I thought datafiable was vital regardless.

seancorfield21:07:59

You need to get the data out of the result set rows before the connection is closed for reliable code, but if your dataset is small and you're using certain databases/drivers/options then you can get away with it.

seancorfield21:07:26

There are several ways to get data out of the result set row -- datafiable-row is a bit of a sledgehammer.