cube-js / cube-js/cube

JSON query resolving to invalid SQL

Open
#9,744 0 comments 0 reactions 0 assignees View on GitHub
question
Dominant language
Rust
Stars
20.8k
Forks
2.1k
Avg merge
1d 2h
Merged PRs (30d)
181

Description

**Problem**

I have several cube definitions with joins in them (.yaml files in the attachment), and when I try to execute the query contained in the .json file in the attachment, it produces the following sql error:
```
Failed to execute SQL for views with include_joins=True, error: Error executing SQL: invalid reference to FROM-clause entry for table "views"
LINE 2: LEFT JOIN public.videos AS "main__videos" ON views.video_id ...
^
HINT: Perhaps you meant to reference the table alias "main__views".
```
The SQL generated is in the .sql file in the attachment

This seems to be a really simple setup, I really don't understand why it produces invalid SQL?

Many thanks,
E.

[failing_sql.zip](https://github.com/user-attachments/files/21020750/failing_sql.zip)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.