It would have that advantage, but nullifies the other advantage of using a
cursor - being able to issue another query at the same time on the same
connection handle.

On Wed, Aug 2, 2017 at 12:24 AM Bas van Dijk <v.dijk....@gmail.com> wrote:

> I realise we should also be able to combine cursor streaming and
> single-result-mode streaming. This would have the advantage of also
> streaming the results in a chunk from a cursor and, in case of termination,
> you only need to drain[1] the results for the current chunk.
>
> [1]
> https://github.com/ocharles/streaming-postgresql-simple/blob/53184571a26cc4e18c1f7c5881b09fe770f62545/Database/PostgreSQL/Simple/Streaming.hs#L164
>
> On 2 August 2017 at 01:13, Bas van Dijk <v.dijk....@gmail.com> wrote:
>
>> Ollie, your streaming-postgresql-simple is really interesting. I didn't
>> know about "single row mode" streaming[1]. I can imagine it's faster than
>> streaming using a cursor since you don't have to send back a "FETCH FORWARD
>> $chunkSize" command for every chunk that you want to fetch. Instead you
>> only read from a socket and push each result on the stream.
>>
>> [1]
>> https://www.postgresql.org/docs/current/static/libpq-single-row-mode.html
>>
>> On 30 July 2017 at 16:52, Oliver Charles <ol...@ocharles.org.uk> wrote:
>>
>>> You might also want to look at streaming-postgresql-simple for similar
>>> prior art.
>>>
>>> Ollie
>>>
>>> On Sun, 30 Jul 2017, 3:47 pm Bas van Dijk, <v.dijk....@gmail.com> wrote:
>>>
>>>> I like the ListT suggestion and just implemented it.
>>>>
>>>> I don't understand how I can get rid of SafeT by using Managed. You're
>>>> talking about Managed from your managed package right?
>>>>
>>>> On 30 July 2017 at 15:58, Gabriel Gonzalez <gabriel...@gmail.com>
>>>> wrote:
>>>>
>>>>> Looks pretty straightforward to me
>>>>>
>>>>> The only other suggestion I'd provide is to also provide a `Managed`
>>>>> version of the same `Producer`, with this type:
>>>>>
>>>>>     query
>>>>>
>>>>> :: (Default QueryRunner columns haskells, MonadIO m, MonadMask m)
>>>>>         => Connection -> Query columns -> Managed
>>>>> (Producer haskells m ())
>>>>>
>>>>> Also, since it doesn't use the return value, you could even use the
>>>>> simpler `ListT` type instead:
>>>>>
>>>>>     query
>>>>>
>>>>> :: (Default QueryRunner columns haskells, MonadIO m, MonadMask m)
>>>>>         => Connection -> Query columns -> Managed (ListT m haskells)
>>>>>
>>>>> ... and then you can always convert that back to a `Producer` using
>>>>> `enumerate` if necessary
>>>>>
>>>>> On Jul 29, 2017, at 2:54 PM, Bas van Dijk <v.dijk....@gmail.com>
>>>>> wrote:
>>>>>
>>>>> Hello,
>>>>>
>>>>> I just started playing with pipes and I really like it so far. For my
>>>>> first project I would like to create a Producer for opaleye query results.
>>>>> I came up with the following:
>>>>>
>>>>>
>>>>> https://github.com/basvandijk/pipes-opaleye/blob/master/src/Pipes/Opaleye/RunQuery.hs
>>>>>
>>>>> Is that the correct way of doing it? What can be improved?
>>>>>
>>>>> Thanks,
>>>>>
>>>>> Bas
>>>>>
>>>>> --
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "Haskell Pipes" group.
>>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>>> an email to haskell-pipes+unsubscr...@googlegroups.com.
>>>>> To post to this group, send email to haskell-pipes@googlegroups.com.
>>>>>
>>>>>
>>>>> --
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "Haskell Pipes" group.
>>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>>> an email to haskell-pipes+unsubscr...@googlegroups.com.
>>>>> To post to this group, send email to haskell-pipes@googlegroups.com.
>>>>>
>>>>
>>>> --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "Haskell Pipes" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>> an email to haskell-pipes+unsubscr...@googlegroups.com.
>>>> To post to this group, send email to haskell-pipes@googlegroups.com.
>>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Haskell Pipes" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to haskell-pipes+unsubscr...@googlegroups.com.
>>> To post to this group, send email to haskell-pipes@googlegroups.com.
>>>
>>
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Haskell Pipes" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to haskell-pipes+unsubscr...@googlegroups.com.
To post to this group, send email to haskell-pipes@googlegroups.com.

Reply via email to