-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Description
The Problem
I auto-generated my Semantic Layer config files using Cube, and was pleased to see the JOINs were correctly created based on the table and column names. But the primary keys were missing, so I hit an error:
Unable to load meta data.
Error: Error: Compile errors:
orders cube: primary key for 'orders' is required when join is defined in order to make aggregates work properly
This was frustrating, especially given Cube was confident enough to write the JOINs.
The dataset I was using was this one, so you can try this for yourself:
demo.duckdb.zip
The solution I'd like
When Cube can find and write JOIN logic using heuristics, and when Primary Key constraints don't exist in the database, please also write the primary-key logic into the semantic layer config too. Ie. Use the same heuristic that was used to write the JOINs to also define the primary keys.
Describe alternatives you've considered
It would also be fine / cool even, if the Primary key suggestions were shown to the user only as suggestions, and the user could confirm, or even modify these, before applying. I think there might be a case for not making mistakes when picking Primary keys, to avoid bad queries and bad data later on down the line.
Additional context
None