|
5 | 5 | ```python
|
6 | 6 | import deepwisdom as dw
|
7 | 7 |
|
8 |
| -# 初始化api客户端, 传入申请的appid, api_key, secret_key |
9 |
| -api_client = dw.Client(appid=4, api_key="xx", secret_key="xxx") |
10 |
| -dw.set_client(client=api_client) |
11 |
| - |
12 |
| -datasets = dw.Dataset.create( |
13 |
| - str_conn='{"host":"xxx","port":"xxx","user":"root","password":"","db":""}', # mysql/hive |
14 |
| - cloud_type=0, # 云类型: 0本地, 1Amazon, 2阿里云, 3腾讯云, 4华为云 |
15 |
| - source=5, # 数据来源: 0本地文件, 1mysql, 2oracle, 3mariadb, 4hdfs, 5hive |
16 |
| - chosed_tables='[{"autotables":[{"table_name":"dataset_update_record"},{"table_name":"scene"}]}]' # 选择的table 列表。 autotables代表db,dataset_update_record|scene代表autotable下的两个表,支持多层嵌套 |
17 |
| - ) |
| 8 | +if __name__ == "__main__": |
| 9 | + # 初始化api客户端, 传入申请的appid, api_key, secret_key |
| 10 | + api_client = dw.Client(appid=4, api_key="xx", secret_key="xxx") |
| 11 | + dw.set_client(client=api_client) |
| 12 | + |
| 13 | + datasets = dw.Dataset.create( |
| 14 | + str_conn='{"host":"xxx","port":"xxx","user":"root","password":"","db":""}', # mysql/hive |
| 15 | + cloud_type=0, # 云类型: 0本地, 1Amazon, 2阿里云, 3腾讯云, 4华为云 |
| 16 | + source=5, # 数据来源: 0本地文件, 1mysql, 2oracle, 3mariadb, 4hdfs, 5hive |
| 17 | + chosed_tables='[{"autotables":[{"table_name":"dataset_update_record"},{"table_name":"scene"}]}]' # 选择的table 列表。 autotables代表db,dataset_update_record|scene代表autotable下的两个表,支持多层嵌套 |
| 18 | + ) |
18 | 19 | ```
|
0 commit comments