API error "One or more Primary key is required for '${cubeName}' cube" even when `allowUngroupedWithoutPrimaryKey` set to true
- Dominant language
- Rust
- Stars
- 20.8k
- Forks
- 2.1k
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 181
Description
**Problem**
I already set `allowUngroupedWithoutPrimaryKey` in `cube.js`, but query with `ungrouped: true` still get error: `"One or more Primary key is required for '${cubeName}' cube"`
In `BaseQuery.js`, i found:
```javascript
/**
*
* @param {string} cubeName
* @returns {Array}
*/
primaryKeyNames(cubeName) {
const primaryKeys = this.cubeEvaluator.primaryKeys[cubeName];
if (!primaryKeys || !primaryKeys.length) {
throw new UserError_1.UserError(`One or more Primary key is required for '${cubeName}' cube`);
}
return primaryKeys.map((pk) => this.primaryKeyName(cubeName, pk));
}
```
`primaryKeyNames` always throws an error when a cube has no primary key. But shouldn’t it check `allowUngroupedWithoutPrimaryKey !== true` first?
Contributor guide
Assessment
This issue has not been assessed yet.