On Wednesday, May 27, 2020 at 9:25:26 AM UTC-7, Jeremy Evans wrote: > > On Wednesday, May 27, 2020 at 8:16:02 AM UTC-7, Aryk Grosz wrote: >> >> Hey Jeremy, I'm only asking because Sequel is so amazing and I figure I >> probably missed something somewhere. >> >> It's not a big deal, I just wrote the joins using join_table and it's >> working well, just bummer can't reuse the associations I already made. >> > > Agreed, but if we can make it easier, that would be best. For simple > associations, it's not a big deal to recreate all of the join parameters, > but the more complex the association, the larger pain it is. > > Sequel has association_left_join and similar methods, so it can customize > the join type for multiple associations at the same level, but it currently > can't use a different join type for a nested association than for the > association it nests under. However, Sequel already supports > per-association custom table aliasing, by passing a > Sequel::SQL::AliasedExpression instead of a symbol as the association. I > think we can expand this support to per-association custom join types: > > Track.dataset.association_inner_join(:album=>Sequel.as(:artist, > :table_alias_name, :join_type=>:left)) > > I'll see if that is workable, and if so I'll implement it. Note that this > isn't specific to association_*_join, it would also work for eager_graph > (association_*_join is basically eager_graph but only keeping the same > joins). >
Support committed: https://github.com/jeremyevans/sequel/commit/ed1a89c0401fef773fa486cda68b2b78544ca6ab 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/7bbb0321-7f16-4aab-b03d-68a08c07e9c7%40googlegroups.com.
