question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

relationships with two fields

See original GitHub issue

We have three tables: matches (id) match_rounds (id, match_id) (field id is non unique) match_round_events (round_id, match_id)

How to create a relationship (join) for events in match_rounds? Like this:

JOIN match_round_events match_round_events.match_id = match_rounds.match_id AND
match_round_events.round_id = match_rounds.id

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
dsandipcommented, Nov 19, 2018

@Maxpain177 you can create the relationship manually using the API (without having to create a Fkey constraint): https://docs.hasura.io/1.0/graphql/manual/api-reference/schema-metadata-api/relationship.html#manual-configuration

This is how your API payload may look like:

{
    "type": "create_array_relationship",
    "args": {
        "table": "match_rounds",
        "name": "round_events",
        "using": {
            "manual_configuration" : {
                "remote_table" : "match_round_events",
                "column_mapping" : {
                    "id" : "round_id",
                    "match_id":"match_id"
                }
            }
        }
    }
}

You should then be able to run queries such as:

{
  match_rounds {
    id
    match_id
    round_events {
      event_name
    }
  }
}
0reactions
maxpaincommented, Nov 19, 2018

Sorry, my mistake.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Create a relationship with multiple columns in Power BI
To create a relationship with multiple columns in Power BI we simply need to create a new column by merging the required columns...
Read more >
Relationship in Power BI with Multiple Columns - RADACAD
The workaround for this problem is easy. Power BI doesn't allow relationship in model based on multiple columns, but Power Query can join...
Read more >
Guide to table relationships - Microsoft Support
A table relationship works by matching data in key fields — often a field with the same name in both tables. In most...
Read more >
About multi-criteria relationships - FileMaker Pro
In a multi-criteria relationship, FileMaker Pro compares the values from each match field on each side of the relationship in the order in...
Read more >
Solved: Establish Active relationship between multiple col...
Establish Active relationship between multiple columns from two table · 1) Joins [Left, Inner, Full Outer] in Power Query · 2) Summary tables...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found