menu
Is this helpful?

# SQL生成API

The use of call method please look over call method description in Open API doc.

# Generate Querying Users SQL

Interface URL

/open/get-sql-for-user-search?token=xxx&projectId=377

Request method

POST

Content-Type

application/json

Request Query Parameter

Parameter name Sample value Parameter type Is required Parameter description
token xxx String Yes token
projectId 0 Integer Yes Project ID

Request Body Parameter

{
  "filter": {
      "filterType": "COMPOUND",
      "relation": "and",
      "filts": [
        {
          "filterType": "SIMPLE",
          "tableType": "user",
          "columnName": "city",
          "comparator": "equal",
          "ftv": [
            "Shanghai"
          ]
        },
        {
          "filterType": "SIMPLE",
          "tableType": "user",
          "columnName": "companynature",
          "comparator": "equal",
          "ftv": [
            "private-owned"
          ]
        }
      ]
  },
  "selectAllColumns": false,
  "selectColumns": [
     "#account_id", "#distinct_id"
  ]
}
$$Parameter name Sample value Parameter type Is required Parameter description
selectAllColumns false Boolean No Whether to query all fields, default false
selectColumns ["#account_id", "#distinct_id"] List No List of query field names
filter - List Yes Attribute filter
filter.filterType COMPOUND String No Filter
  • COMPOUND: composite type

  • SIMPLE: Simple type

filter.relation and String No Filter logical relationships
filter.filts - Object No Filter object list
filter.filts.filterType SIMPLE String No Filter
  • COMPOUND: composite type

  • SIMPLE: Simple type

filter.filts.tableType user String No Event: event attribute, user: user feature
filter.filts.columnName city String Yes Field name
filter.filts.comparator equal String No Comparison operator
filter.filts.ftv ["Private"] List No Filtered value list

Successful Response Example

{
  "data": {
    "sql": "select \"#user_id\", \"#account_id\", \"#distinct_id\" from (v_user_377) where (\"city\" IN ('上海市')) and (\"companynature\" IN ('民营'))"
  },
  "return_code": 0,
  "return_message": "success"
}
$$Parameter name Sample value Parameter type Parameter description
data - Object Return result
data.sql "select \"#user_id\", \"#account_id\", \"#distinct_id\" from (v_user_377) where (\"city\" IN ('Shanghai')) and (\"companynature\" IN ('private owned'))" String SQL statement
return_code 0 Integer Return code
return_message success String Return information

Error Response Example

{
    "return_code": -1008,
    "return_message": "error description"
}
Parameter name Sample value Parameter type Parameter description
return_code -1008 Integer Return code
return_message Error description String Return information