menu
Is this helpful?

# 参照テーブルAPI

Call method See Call method description in Open API doc.

# Create Dimension Table

note

  • The request body is the content of the dimension table , see the configuration of the dimension table creation parameter createParam for details.
  • The default maximum file limit is 200M.

Interface URL

/open/dict-create?token=xxx&projectId=0

Request method

POST

Content-Type

text/csv

Request Query Parameter

Parameter name Sample value Parameter type Is required Parameter description
token xxx String Yes token
projectId 0 Integer Yes Project ID
createParam {"mainColumn":{"property":{"columnName":"channel","tableType":"event"}},"columns":[{"property":{"columnName":"channel_id","selectType":"string"}},{"property":{"columnName":"channel_name","columnDesc":"channel type","selectType":"string"}}]} String Yes Create dimension column information description

Dimension Table Create Parameter CreateParam Configuration

Create Dimension Attributes

The main field here is channel , which is associated with the channel_id in the dimension table and adds dimension table attributes channel_name

  1. Dimension Table Example

The dimension table data is in csv format, and the first column is associated with the field

The first behavior column name, the second row starts with data.

channel_id,channel_name
1. Longteng Area 1
2. Longteng Zone 2
3. Longteng Zone 3

2.createParam example (create the above dimension table for the channel field of the transaction table).

In the columns list, the order of the elements must be consistent with the order and naming of the columns in the dimension table data. Wherein the first element (corresponding to the first column associated column) can be named the same or different from the parent element (if different, only the beginning of the letter and only contain alphanumeric underscores).

{
  "mainColumn": {
    "property": {
      "columnName": "channel",
      "tableType": "event",
      "timestampJoinFormat": null
    }
  },
  "columns": [
    {
      "property": {
        "columnName": "channel_id",
        "selectType": "number"
      }
    },
    {
      "property": {
        "columnName": "channel_name",
        "columnDesc": "channel type",
        "selectType": "string"
      }
    }
  ]
}

3.createParam Field Explanation

MainColumn node (the main field description node that creates the dimension table)

Attribute name Attribute description
property Main attributes (both physical and virtual)
columnName Main property field name
tableType The main attribute belongs to the table type, event: event attribute; user: user feature
timestampJoinFormat If the main attribute is a timestamp, it is supported to bind the dimension attribute after granularity calculation by timestamp

TimestampJoinFormat supports the following granularity types.

Value Description
DATE_STR_YEAR Attributes will be formatted as "yyyy" string after binding dimension attributes
DATE_STR_MONTH The attribute will be formatted as "yyyy-MM" after binding the dimension attribute
DATE_STR_DAY The attribute will be formatted as "yyyy-MM-dd" after binding the dimension attribute
DATE_STR_HOUR The attribute will be formatted as "yyyy-MM-dd hh" after binding the dimension attribute
DATE_STR_MINUTE The attribute will be formatted as "yyyy-MM-dd HH: mm" after binding the dimension attribute
DATE_STR_SECOND The attribute will be formatted as "yyyy-MM-dd HH: mm: ss" after binding the dimension attribute
DATE_STR_MILLISECOND The attribute will be formatted as "yyyy-MM-dd HH: mm: ss. SSS" after binding the dimension attribute

Columns List (dimension field description node)

In the columns list, the order of the elements must be consistent with the order of the columns in the dimension table data.

Attribute name Attribute description
property Dimension field attribute list
columnName Dimension field name
columnDesc Dimension field description, that is, the display name of the field (optional)
selectType Dimension field types: number value, bool boolean, string string, datetime date type
  1. Create Results

After the creation is successful, you can find the dimension table attribute namedchannel@channel _name

Successful Response Example

{
  "data": {
    "duplcatedMainKeyColumns": ["activity_type@type_test"],
    "duplcatedMainKeyLineNum": 2,
    "mainKeyErrorColumns": ["activity_type@type_test"],
    "mainKeyErrorLineNum": 3,
    "successLineNum": 27,
    "totalLineNum": 40,
    "typeErrorColumns": ["numwrong_test", "boolwrong_test"],
    "typeErrorLineNum": 8
  },
  "return_code": 0,
  "return_message": "success"
}
$$Parameter name Sample value Parameter type Parameter description
return_code 0 Integer Return code
return_message success String Return information
data - Object Return result
data.duplcatedMainKeyColumns ["activity_type@type_test"] List Duplicate column names associated with primary fields
data.duplcatedMainKeyLineNum 2 Integer Number of duplicate rows associated with primary field (automatically discarded)
data.mainKeyErrorColumns ["activity_type@type_test"] List Column name associated with primary field analysis error
data.mainKeyErrorLineNum 3 Integer The number of rows associated with the main field analysis error (will be automatically discarded)
data.successLineNum 27 Integer Number of successful lines
data.totalLineNum 40 Integer Total number of rows
data.typeErrorColumns ["numwrong_test", "boolwrong_test"] List Other field type wrong column name
data.typeErrorLineNum 8 Integer Number of lines with other field types wrong (will be left blank)

Error Response Example

{
    "return_code": -1008,
    "return_message": "Upload file size cannot exceed 209715200 bytes"
}
Parameter name Sample value Parameter type Parameter description
return_code -1100 Integer Return code
return_message Upload file size cannot exceed 209715200 bytes String Return information

Curl Example

curl --header 'Content-Type: text/csv' --data-binary '@test.csv' 'http://ta2:8992/open/dict-create?token=bTOzKiTIozG4e19FgXphcA8dDV3DIY8RwdHTO7aSnBsRqSNaIk19BnBMecJDWibD&projectId=377&createParam=%7B%22mainColumn%22%3A%7B%22property%22%3A%7B%22columnName%22%3A%22channel%22%2C%22tableType%22%3A%22event%22%7D%7D%2C%22columns%22%3A%5B%7B%22property%22%3A%7B%22columnName%22%3A%22channel_id%22%2C%22selectType%22%3A%22string%22%7D%7D%2C%7B%22property%22%3A%7B%22columnName%22%3A%22channel_name%22%2C%22columnDesc%22%3A%22%E6%B8%A0%E9%81%93%E7%B1%BB%E5%9E%8B%22%2C%22selectType%22%3A%22string%22%7D%7D%5D%7D'