t_table_map(data, field, output_fields, missing=None, mode="fill-auto")
Parameter | Description | Parameter Type | Required | Default Value | Value Range |
data | Target table (dimension table) | table | Yes | - | - |
field | Map the source field to the table in logs. If the corresponding field does not exist in logs, perform no operation. Supports String and String List. | any | Yes | - | - |
output_fields | Mapped fields, such as ["province", "pop"]. Supports String and String List. | any | Yes | - | - |
missing | When no match field is found, assign the parameter value to the output field output_fields. | String | No | - | - |
mode | Field coverage mode. Default is fill-auto. | String | No | fill-auto |

[{"user_id": 1},{"user_id": 3}]
//On the console, set the alias configuration of external data MySQL to hm, the db of mysql to test222, and the table name to test//Pull all data from MySQL and use the t_table_map function to join dimensional tablest_table_map(res_rds_mysql(alias="hm",database="test222",sql="select * from test"),"user_id",["gameid", "game"])
[{"user_id":"1"},{"game":"wangzhe","gameid":"123","user_id":"3"}]
id | game_id | game_name | region | game_details |
1 | 10001 | Honor of Kings | CN | MOBA |
2 | 10002 | League of Legends | NA | PC MOBA |
3 | 10003 | Genshin Impact | CN | RPG |
4 | 10004 | Black Myth: Wukong | CN | PC Game |
5 | 10005 | Diablo | NA | Role play |
[{"Pid": 1},{"Pid": 2},{"Pid": 3}]
//On the console, set the alias configuration of external data MySQL to hm, the db of mysql to test222, and the table name to test//Pull some data from MySQL and use the t_table_map function to join dimensional tables//The log field Pid relates to the id field in MySQL, with different names//Enrich the game_details field from MySQL, rename to game_info in logst_table_map(res_rds_mysql(alias="hm",database="test222",sql="select * from test where region='CN'"),[["Pid", "id"]],["game_name",["game_details","game_info"]])
[{"Pid":"1""game_info":"MOBA mobile game""game_name":"Honor of Kings"},{"Pid":"2"},{"Pid":"3""game_info":"open world RPG game""game_name":"Genshin Impact"}]
enrich_table("csv source data", "csv enrichment field", output="target field1, target field2, target field...", mode="overwrite")
Parameter | Description | Parameter Type | Required | Default Value | Value Range |
data | Input CSV data, where the first row is column names and the rest rows are corresponding values. Example: region,count\\nbj, 200\\ngz, 300 | String | Yes | - | - |
fields | Column name to match. If the field name in the CSV data is the same as the field with the same name in the log, the matching is successful. The value can be a single field name or multiple new field names concatenated with commas. | String | Yes | - | - |
output | Output field list. The value can be a single field name or multiple new field names concatenated with commas. | String | Yes | - | - |
mode | Write mode of the new field. Default value: overwrite | String | No | overwrite | - |
{"region": "gz"}
enrich_table("region,count\\nbj,200\\ngz,300", "region", output="count")
{"count":"300","region":"gz"}
enrich_dict("JSON dictionary", "source field name", output=target field name, mode="overwrite")
Parameter | Description | Parameter Type | Required | Default Value | Value Range |
data | Input dict data, which must be the escape string of JSON object, for example: {\\200\\":\\"SUCCESS\\". | String | Yes | - | - |
fields | Field name to match. If the value of the key in the dict data is the same as the value of the specified field, the matching is successful. The value can be a single field name or multiple new field names concatenated with commas. | String | Yes | - | - |
output | Target field list. After successful matching, the function writes the corresponding values in the dict data to the target field list. The value can be a single field name or multiple new field names concatenated with commas. | String | Yes | - | - |
mode | Write mode of the new field. | String | No | overwrite |
{"status": "500"}
enrich_dict("{\\"200\\":\\"SUCCESS\\",\\"500\\":\\"FAILED\\"}", "status", output="message")
{"message":"FAILED","status":"500"}
Feedback