[Doris Stream Load] python调用stream load

数据分析

2021-01-21

48

0

安装requests

pip install requests

python代码


# coding=utf-8
import requests
import time


def main():
    user = 'doris账号'
    password = 'doris密码'
    while 1:
        url = 'http://fe ip:fe http端口/api/库名/表名/_stream_load'
        doris_headers = {
            'label': '导入任务的名字, 每次不一样',
            'column_separator': '分隔符,默认是制表符',
            'Content-Type': 'application/octet-stream'
        }
        response = requests.put(url,
                                data=open(
                                    '文件路径'),
                                headers=doris_headers, auth=(user, password)
                                )
        print(response.text)
        time.sleep(60)


if __name__ == '__main__':
    main()

`

欢迎添加微信,互相学习↑↑↑ -_-

发表评论

全部评论:0条

白老虎

programming is not only to solve problems, ways to think