THIS IS A TEST INSTANCE. ALL YOUR CHANGES WILL BE LOST!!!!

Apache Kylin : Analytical Data Warehouse for Big Data

Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

POST /kylin/api/query

Request Body

...

Variable name

NecessaryTypeDescription
sqlyesstringThe text of sql statement

...

offset

...

nointQuery offset. If offset is set in sql, curIndex will be ignored

...

limit

...

nointQuery limit. If limit is set in sql, perPage will be ignored

...

acceptPartial

...

noboolWhether accept a partial result or not, default be “false”. Set to “false” for production use

...

project

...

nostringProject to perform query. Default value is

...

“DEFAULT”

Request Sample

Code Block
languagejs
themeEmacs
firstline1
titleSample
{
    "sql":"select count(*) from kylin_sales",
    "offset":0,
    "limit":50000,
    "acceptPartial":false,
    "project": "learn_kylin"
}

Curl Example

curl -X POST -H "Authorization: Basic XXXXXXXXX" -H "Content-Type: application/json" 
-d '{ "sql":"select count(*) from kylin_sales", "project":"learn_kylin" }' http://localhost:7070/kylin/api/query

Response Body

Variable name

Description
columnMetas

...

Column metadata information of result set

...

results

...

Data set of result

...

cube

...

Cube used for this query

...

affectedRowCount

...

Count of affected row by this sql statement

...

isException

...

Whether this response is an exception

...

ExceptionMessage

...

Message content of the exception

...

Duration

...

Time cost of this query
Partial

...

Whether the response is a partial result or not. Decided by acceptPartial of request

...

Response Sample

Code Block
languagejs
themeEmacs
firstline1
titleSample
{

...


    "columnMetas": [

...


        {

...


            "isNullable": 0,

...


            "displaySize": 19,

...


            "label": "EXPR$0",

...


            "name": "EXPR$0",

...


            "schemaName": null,

...


            "catelogName": null,

...


            "tableName": null,

...


            "precision": 19,

...


            "scale": 0,

...


            "columnType": -5,

...


            "columnTypeName": "BIGINT",

...


            "autoIncrement": false,

...


            "caseSensitive": true,

...


            "searchable": false,

...


            "currency": false,

...


            "signed": true,

...


            "writable": false,

...


            "definitelyWritable": false,

...


            "readOnly": true

...


        }

...


    ],

...


    "results": [

...


        [

...


            "459"

...


        ]

...


    ],

...


    "cube": "CUBE[name=kylin_sales_cube]",

...


    "affectedRowCount": 0,

...


    "isException": false,

...


    "exceptionMessage": null,

...


    "duration": 2557,

...


    "totalScanCount": 0,

...


    "totalScanBytes": 0,

...


    "hitExceptionCache": false,

...


    "storageCacheUsed": false,

...


    "traceUrl": null,

...


    "partial": false,

...


    "pushDown": false

...


}

Prepare query

POST /kylin/api/query/prestate

Request Body

Variable name

NecessaryTypeDescription
sql

...

yesstringThe text of sql statement

...

offset

...

nointQuery offset. If offset is set in sql, curIndex will be ignored

...

limit

...

nointQuery limit. If limit is set in sql, perPage will be ignored

...

acceptPartial

...

noboolWhether accept a partial result or not, default be “false”. Set to “false” for production use

...

project

...

nostringProject to perform query. Default value is

...

“DEFAULT”

Request Sample

Code Block
languagejs
theme

...

Emacs
firstline1
titleSample
{
    "sql":"select count(*) from kylin_sales",

...


    "offset":0,

...


    "limit":50000,

...


    "acceptPartial":false,

...


    "project":

...

"learn_kylin"
}

...


...

Save query
POST /kylin/api/saved_queries

Request Body

Variable name

NecessaryType

...

Description
sqlyesstringThe text of sql statement

...

name

...

yesstringSql name

...

project

...

yesstringProject to perform query

...

description

...

noboolSql description

...

Request Sample

...

Code Block
languagejs
firstline1
titleSample
linenumberstrue
collapsetrue
{
    "sql":

...

"select count(*) from kylin_sales",

...

    "name":

...

"test",

...

    "project":

...

"learn_kylin"
}

Remove saved query

DELETE /kylin/api/saved_queries/{id}

Path Variable 

...

Variable name

NecessaryTypeDescription
idyesstringThe id of saved query you want to remove

Get saved queries

GET /kylin/api/saved_queries

Response Sample

Code Block
languagejs
firstline1
titleSample
linenumberstrue
collapsetrue
[
    {
        "name": "test",
        "project": "learn_kylin",
        "sql": "select count(*) from kylin_sales",
        "description": null,
        "id": "-1674470999"
    }
]

Get running queries

GET /kylin/api/query/runningQueries

...

PUT /kylin/api/query/{queryId}/stop

Path Variable

Variable name

NecessaryType

...

Description
queryIdyesstring

The queryId of you want to stop. You can obtain it by Get running queries

...

List queryable tables

GET /kylin/api/tables_and_columns

Request Parameters

Variable name

Necessary

...

TypeDescription
projectyesstring

The project to load tables

Response Sample

Code Block
languagejs
firstline1
titleSample
linenumbers

...

true
collapsetrue
[
    {

...


        "columns": [

...


            {

...


                "table_SCHEM": "DEFAULT",

...


                "table_NAME": "KYLIN_ACCOUNT",

...


                "column_NAME": "ACCOUNT_ID",

...


                "table_CAT": "defaultCatalog",

...


                "data_TYPE": -5,

...


                "type_NAME": "BIGINT",

...


                "column_SIZE": -1,

...


                "buffer_LENGTH": -1,

...


                "decimal_DIGITS": 0,

...


                "num_PREC_RADIX": 10,

...


                "nullable": 1,

...


                "remarks": null,

...


                "column_DEF": null,

...


                "sql_DATA_TYPE": -1,

...


                "sql_DATETIME_SUB": -1,

...


                "char_OCTET_LENGTH": -1,

...


                "ordinal_POSITION": 1,

...


                "is_NULLABLE": "YES",

...


                "scope_CATLOG": null,

...


                "scope_SCHEMA": null,

...


                "scope_TABLE": null,

...


                "source_DATA_TYPE": -1,

...


                "is_AUTOINCREMENT": ""

...


            }

...


        ],

...


        "table_SCHEM": "DEFAULT",

...


        "table_NAME": "KYLIN_SALES",

...


        "table_TYPE": "TABLE",

...


        "type_SCHEM": null,

...


        "self_REFERENCING_COL_NAME": null,

...


        "ref_GENERATION": null,

...


        "type_CAT": null,

...


        "table_CAT": "defaultCatalog",

...


        "type_NAME": null,

...


        "remarks": null

...


    }

...


]