Stream not working
callmeahab opened this issue · comments
Miloš Marković commented
When i try executing:
Ecto.Adapters.SQL.stream(ArcGisRepo, "SELECT TOP 1000 CONVERT(VARCHAR(MAX), [Shape]) AS Shape from TREETOP_DETECTION") |> Enum.to_list()
I get the following error: (RuntimeError) cannot reduce stream outside of transaction
.
Milan Jaric commented
That error is Ecto runtime error, and you have to open transaction, regardless if you are reading only data. It may trow other errors, e.g. on disconnect, and sometimes you may get null as result.
Anyways, we didn't implemented that feature, so you have to use offset if you want to get page by page here is the method which should do that, but it will only raise exception.
Miloš Marković commented
Alright. Thanks.