You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@kylin.apache.org by Marcel Jacob <m....@hotmail.com> on 2016/01/05 13:03:58 UTC

Kylin cube programmatically without using Web UI

Hello all,
I followed the steps in sample.sh and successfully built my first cube. 
Now I try to understand the procedure behind it. But there are some 
files which were not created within the sample.sh, e.g. metadata.

My aim is to create a cube programmatically without the Web UI. This is 
the stage of affairs with some questions:
The first thing sample.sh does is loading tables in hive. I have some 
.csv files and created an executable hiveql-file for creating the 
schema. But is there a class in kylin (or hive) which can produce a 
hiveql-file from .csv automatically?
In step two sample.sh uploads metadata in hbase. But how to create these 
metadata - json files? I know there were plenty of *Desc-classes like 
CubeDesc, DataModelDesc, DimensionDesc and so on. And with 
JsonUtil.writeAsIndentString() I can convert my java object in json 
format. But some json-files refer to each other. Is there a class which 
creates all the metadata in one place?
Do I need the json-files or is it enough to create a CubeDesc and then 
calling cubeMgr.createCube("myCube", "testProject", cubeDesc, null)?

Thanks in advance,
Marcel Jacob.


Re: Kylin cube programmatically without using Web UI

Posted by Jian Zhong <zh...@apache.org>.
WEB UI do all this call Kylin Rest API, you can do this by call API
directly.

We did not provide how to use the create Cube API on site doc page.

for Cube Create, you can check below link and find method 'saveCubeDesc()'

https://github.com/apache/kylin/blob/master/server/src/main/java/org/apache/kylin/rest/controller/CubeController.java

for example in Kylin 1.x.

URL:http://localhost:7070/kylin/api/cubes
METHOD:post
Request Payload:
{
cubeDescData:"{'name':'cube_test_1','description':''.......}",
  modelDescData:"{'name':'model_test_1','fact_table':'cube_fact'....}",
  project:"test_proj"
}

example of cubeDescData and modelDescData
https://github.com/apache/kylin/tree/master/examples/test_case_data/localmeta/cube_desc
https://github.com/apache/kylin/blob/master/examples/test_case_data/localmeta/model_desc/test_kylin_with_slr_model_desc.json

remember add basic auth info to http header.

On Tue, Jan 5, 2016 at 8:03 PM, Marcel Jacob <m....@hotmail.com> wrote:

> Hello all,
> I followed the steps in sample.sh and successfully built my first cube.
> Now I try to understand the procedure behind it. But there are some
> files which were not created within the sample.sh, e.g. metadata.
>
> My aim is to create a cube programmatically without the Web UI. This is
> the stage of affairs with some questions:
> The first thing sample.sh does is loading tables in hive. I have some
> .csv files and created an executable hiveql-file for creating the
> schema. But is there a class in kylin (or hive) which can produce a
> hiveql-file from .csv automatically?
> In step two sample.sh uploads metadata in hbase. But how to create these
> metadata - json files? I know there were plenty of *Desc-classes like
> CubeDesc, DataModelDesc, DimensionDesc and so on. And with
> JsonUtil.writeAsIndentString() I can convert my java object in json
> format. But some json-files refer to each other. Is there a class which
> creates all the metadata in one place?
> Do I need the json-files or is it enough to create a CubeDesc and then
> calling cubeMgr.createCube("myCube", "testProject", cubeDesc, null)?
>
> Thanks in advance,
> Marcel Jacob.
>
>