Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Feature: foreign keys not supported with bigquery? #4795
Do you see any fields we've identified as "Primary Key" in your data model? We only let you point an FK to another table's primary key. It's possible we're not correctly identifying your PKs in BigQuery.
Can you share the schema for that table and the table you're trying to links to?
@salsakran Maybe totally unrelated but my observation:
One of the features of BQ is that you do not need primary keys and other similar setups to make query execution faster. Most of the times BQ is used for analytics data warehousing where creating a unique key is not required.
But even in those cases, one might want to query on two tables and using joins they can do so. This is currently possible in SQL query builder. To make it work in the GUI query builder, the requirement becomes that tables need to share a column which contains a unique value which can be used for FK references.
This is one of the limits I have encountered while using Metabase. It works well for me cause I can write SQL queries, but isn't the case for others.
Not sure how one would approach about solving it but it could be as simple as providing the ability to define FK references in BQ based table without doing any actual identification. This will allow me to create a map/join for different columns on different tables and now it's up to me to make sure that my data is actually joinable on those set of columns.
@salsakran its like @VikramTiwari describes it. we use bigquery as our dwh and don't define any keys and want to enable people who don't write SQL to use do queries, in our case its crucial since we rely on joins using a fact -> dimension model.
@VikramTiwari thanks for the explanation thats exactly our use case.