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

Cubes using sql_table cant be exented with sql #8519

Open
thePermission opened this issue Jul 26, 2024 · 1 comment
Open

Cubes using sql_table cant be exented with sql #8519

thePermission opened this issue Jul 26, 2024 · 1 comment
Assignees
Labels
data modeling enhancement New feature proposal

Comments

@thePermission
Copy link

thePermission commented Jul 26, 2024

Describe the bug
Hey Guys, i tried to follow:
https://cube.dev/docs/product/data-modeling/concepts/polymorphic-cubes
and
https://cube.dev/docs/product/data-modeling/concepts/code-reusability-extending-cubes
but if you use sql_table in your base cube and sql in your extended cube, then u get the error:
You must use either sql or sqlTable within a model, but not both

To Reproduce

  1. Create a Base Cube like this:
cubes:
 - name: users
   sql_table: users
  1. Extend the Base Cube like this:
cubes:
  - name: teachers
    extends: users
    sql: >
      SELECT * FROM {users.sql()} WHERE type = 'teacher'
 
  - name: students
    extends: users
    sql: >
      SELECT * FROM {users.sql()} WHERE type = 'student'

Expected behavior
I would expect the sql attribute to overwrite the sql_table

@ovr ovr added the bug Something isn't working label Jul 26, 2024
@ovr ovr self-assigned this Jul 26, 2024
@igorlukanin igorlukanin added enhancement New feature proposal data modeling and removed bug Something isn't working labels Sep 30, 2024
@igorlukanin
Copy link
Member

It makes sense to make he sql parameter to supersede the sql_table one. However, I think this is rather a feature request than a bug since a correct error message is provided by Cube now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
data modeling enhancement New feature proposal
Projects
None yet
Development

No branches or pull requests

3 participants