You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The question is strictly related to convenience of using sequel-combine. Actually combine-sequel works properly if column names are unique in a set of used relations, but if child and parent relations will have the same column, the query will don't return results in any "combined" objects.
For example:
DB[:groups].combine(many: {users: [DB[:users],id: :group_id]})#=> SELECT *, (SELECT row_to_json(ROW) FROM (SELECT * FROM groups WHERE (group_id = id)) AS ROW) AS group FROM users"
If group_id column exist only in users table, query will works perfectly.
If group_id column exist(for some weird reasons) in both tables, the query doesn't specify which column is desirable.
Possible solutions:
Auto inferring datasets by sequel-combine where an order of keys id: :group_id is important.
DB[:groups].combine(many: {users: [DB[:users],id: :group_id]})#=> SELECT *, (SELECT row_to_json(ROW) FROM (SELECT * FROM groups WHERE (users.group_id = groups.id)) AS ROW) AS group FROM users"
Manual inferring datasets by developer.
DB[:groups].combine(many: {users: [DB[:users],groups__id: :users__group_id]})#=> SELECT *, (SELECT row_to_json(ROW) FROM (SELECT * FROM groups WHERE (users.group_id = groups.id)) AS ROW) AS group FROM users"
The text was updated successfully, but these errors were encountered:
The question is strictly related to convenience of using sequel-combine. Actually combine-sequel works properly if column names are unique in a set of used relations, but if child and parent relations will have the same column, the query will don't return results in any "combined" objects.
For example:
If
group_id
column exist only inusers
table, query will works perfectly.If
group_id
column exist(for some weird reasons) in both tables, the query doesn't specify which column is desirable.Possible solutions:
id: :group_id
is important.The text was updated successfully, but these errors were encountered: