I believe the REST api only supports queries.
You would create node/javascript app to generate the schema via a program. You can also use the cli which is a node application.
as suggested this a cube.js issue and you should ask their support.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
How can I automatically generate the DataModel for the tables from code instead of having to open Cube.js Playground manually?
I am currently using the following code, which works fine for me. However, in order for this to run, I have to open the Cube.js Playground and generate the schema for the tables. Otherwise, the following error appears:
Code:
public async Task<string> GetRoomOccupancyDataAsync()
{
var query = new
{
var query = new { query = new { measures = new[] { "table.count" }, dimensions = new[] { "table.x", "table.y" }, limit = 10 } };
limit = 10
};
var jsonQuery = JsonSerializer.Serialize(query);
var request = new HttpRequestMessage(HttpMethod.Post, "http://localhost:4000/cubejs-api/v1/load")
{
Content = new StringContent(jsonQuery, Encoding.UTF8, "application/json")
};
var response = await _httpClient.SendAsync(request);
if (!response.IsSuccessStatusCode)
{
var errorContent = await response.Content.ReadAsStringAsync();
throw new HttpRequestException($"Error: {response.StatusCode}, Details: {errorContent}");
}
return await response.Content.ReadAsStringAsync();
}
Service[0]
Error '{"type":"UserError","error":"Cube 'table' not found for path 'table.count'","stack":"Error: Cube 'table' not found for path 'table.count'\n at CubeEvaluator.byPath (/cube/node_modules/@cubejs-backend/schema-compiler/src/compiler/CubeEvaluator.ts:618:13)\n
How can I automate the schema generation process directly from the code without relying on the Cube.js Playground?
I believe the REST api only supports queries.
You would create node/javascript app to generate the schema via a program. You can also use the cli which is a node application.
as suggested this a cube.js issue and you should ask their support.