Hi Jeremy,

Yes thanks we have switched over to select_hash and observed the desired 
effect. However the documentation here: 
https://sequel.jeremyevans.net/rdoc/classes/Sequel/Dataset.html#method-i-select_hash
 may 
be wrong as it seems to imply SELECT * will be used in the array as 
arguments case.

On Wednesday, September 9, 2020 at 10:07:20 PM UTC+8 Jeremy Evans wrote:

> On Tuesday, September 8, 2020 at 10:14:17 PM UTC-7, [email protected] 
> wrote:
>>
>> Hello,
>>
>> I've been using Dataset#as_hash with an Array for the value argument 
>> thinking it would it would avoiding fetching the rows in their entirety but 
>> read today here 
>> https://sequel.jeremyevans.net/rdoc/classes/Sequel/Dataset.html#method-i-as_hash
>>  
>> which implies it will always SELECT *.
>>
>> I'm curious as to why it should be that way?
>>
>
> This is by design, as the arguments to to_hash are the column names in the 
> result set, not in the table:
>
>   DB[:table].select{[a.as(:b), c(:d).as(:e)]}.to_hash(:b, :e)
>
> Use select_hash if you want to set the column selection and return a hash 
> in the same method call.
>
> Thanks,
> Jeremy
>

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sequel-talk/821a865d-b60e-48ed-885d-021ba073207an%40googlegroups.com.

Reply via email to