livehelpnow / tds_ecto

TDS Adapter for Ecto

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Stream not working

callmeahab opened this issue · comments

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.

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.

Alright. Thanks.