-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Unable to reference static cube names (inside schema folder) in the dynamic schema while creating joins #1880
Comments
@manickaws current you can use
|
Hi @manickaws, just wanted to follow up and see if @rongfengliang's suggestion worked for you? |
how to do this in a view created with Example: asyncModule(async () => {
// Create the objects for the view
const viewObject = {
title: i18n.gettext(`[Traffic Vertical]`),
cubes: [
// Calendar is the cube that "glues" all together
{
join_path: calendar,
includes: "*",
prefix: true,
},
// Counters
{
join_path: calendar.traffic_counter,
includes: "*",
prefix: true,
},
};
if (someFunc("some_arg")) {
view(`traffic`, viewObject);
}); I'm dynamically creating views and cubes based on
Any help? |
@diogosilva30 You can use strings in join_path instead. Like |
Hi @manickaws 👋 I have just tried the following data model: cube(`A`, {
sql: `SELECT 123 AS value`,
dimensions: {
value: {
sql: `value`,
type: `number`,
primary_key: true
}
}
})
asyncModule(async () => {
cube(`B`, {
sql: `SELECT 123 AS value`,
joins: {
A: {
relationship: `one_to_one`,
sql: `${CUBE.value} = ${A.value}`
}
},
dimensions: {
value: {
sql: `value`,
type: `number`,
primary_key: true
}
}
})
}) It generates correct SQL: So, here's how you can generate joins dynamically. Does this answer your question? |
Description:
I have static cubes inside the schema folder (eg: Users). I also create dynamic schema fetching from database. The dynamic schema works perfectly. However when i try to join the dynamic cubes and the static cubes , i get reference error "Users is not defined"
To Reproduce:
Create a static cube inside schema folder. Fetch the data from Database and create dynamic schema. Now inside the dynamic schema try to create a relationship with the static cube using "belongs to". In the playground when you click the "dimensions" button, you will get a reference error.
Screenshot of the code as below :
Screenshot of the error as below :
Version Used : 0.22.3
The text was updated successfully, but these errors were encountered: