Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: foreign keys not supported with bigquery? #4795

Open
kritop opened this issue Apr 17, 2017 · 7 comments

Comments

@kritop
Copy link

commented Apr 17, 2017

When i try to add a foreign key in the Admin Panel -> Data Model

i see
screen shot 2017-04-17 at 15 44 10

is that due missing support for foreign keys with bigquery? or am i doing something wrong?

@salsakran

This comment has been minimized.

Copy link
Contributor

commented Apr 17, 2017

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?

@VikramTiwari

This comment has been minimized.

Copy link
Contributor

commented Apr 18, 2017

@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.

@kritop

This comment has been minimized.

Copy link
Author

commented Apr 18, 2017

@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.
as @VikramTiwari described it would be great to manually assign FK without detection, hence this is a admin task i don't see any issue any users messing them up

@VikramTiwari thanks for the explanation thats exactly our use case.

@kritop

This comment has been minimized.

Copy link
Author

commented Apr 24, 2017

@salsakran i tried to setup a manual foreign key relation to another table and ended up with this error:

http://look.neta.io/k8Ai

also isn't it clearer to show the joined table instead of the key "order number" ?

@salsakran

This comment has been minimized.

Copy link
Contributor

commented Apr 26, 2017

is that the case for aggregations as well?

@HelenMertes

This comment has been minimized.

Copy link

commented Apr 27, 2017

Yes, it is the same for aggregations, too

@MiBaDK

This comment has been minimized.

Copy link

commented May 23, 2017

The error @kritop is getting would be this issue I believe: #4218

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.