目录
此内容是否有帮助?

# Generate SQL Statement API

Call method See Call method description in Open API doc.

# Generate SQL Statements for Querying Users

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
filterType COMPOUND
String
No
Filter
COMPOUND: composite type
SIMPLE: Simple type
relation and
String
No
Filter logical relationships
filts -
Object
No
Filter object list
filterType SIMPLE
String
No
Filter
COMPOUND: composite type
SIMPLE: Simple type
tableType user
String
No
Event: event attribute, user: user feature
columnName city
String
Yes
Field name
comparator equal
String
No
Comparison operator
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
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