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/69821e44-925c-469e-bb87-9db6cc0e247fo%40googlegroups.com.