Cube and API use cases

Hello I have couple of questions to be assured from after reading the documentation:

it is written that it is Cubes are typically declared in separate files with one per file. So in another way it does not say we cannot do that, so the question is can we create different and multiple cube files for the same table?

can we apply the (filters dynamically) on a specific measure in a cube using an API? instead of creating a dynamic schema?

:wave: @FatimaShubeilat welcome to our forum :smiley: Could you also provide link(s) to documentation page that you have questions on? Thanks!

Hi :smiley:
Here mentioning that Cubes are typically declared in separate files
so can we create different and multiple cube files for the same table?

for the second one, has no documentation just came after reading about dynamic schema

Hi @FatimaShubeilat :wave:

If I understand your first question correctly, then yes, you can have separate cubes in separate files all pointing to the same table in your database. This is actually a super-effective way of breaking down a source database table into different “facets” so you can then join with other cubes to get help with data analysis.

As for the filters, unfortunately there’s no way to programmatically add filters to schemas via the Cube.js API. You can pass them in the JSON query, or alternatively, declare segments in the schema and specify those in the JSON query.

1 Like

@hassankhan Hi Hassan, I want to connect a platform that has multiple bots on with the cube js, my concerns is that can I control from the backend which data to be sent, as each bot won’t be exposing the other bots analysis?

Hi @FatimaShubeilat :wave:

That should indeed be possible. I’m assuming the bots already write to a database somewhere, as long as they have some sort of unique identifier (either per-bot or for a group of bots i.e. all of a customer’s bots) then you should be able to separate the results with Cube.js.

Hope that helps :grinning:

1 Like

yes it does! thanks a million @hassankhan :grinning_face_with_smiling_eyes:

1 Like