cube
cube copied to clipboard
Problem with “Polymorphic cubes”
Hey Guys, i try 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 i get the feeling there is some issue with defining sql and sql table With a Cube like this:
cubes:
- name: users
sql_table: users
i cant write cubes 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'
it will cause the error
You must use either sql or sqlTable within a model, but not both
Hi @thePermission 👋
As the error suggests, you'd have to use sql
instead of sql_table
in the users
cube. Could you please try that?
@thePermission Did my advice help?
@igorlukanin Yea but the documentation is wrong then.