简体   繁体   English

在 Azure 上运行 Python 脚本并保存到 SQL 数据库

[英]Run Python script on Azure and save to SQL database

We have just signed up with Azure and were wondering how to schedule and run Python scripts that extract data from various sources like APIs, web scrape scripts, etc. What is the best tool on Azure that can run and schedule those scripts as well as save to target destination. We have just signed up with Azure and were wondering how to schedule and run Python scripts that extract data from various sources like APIs, web scrape scripts, etc. What is the best tool on Azure that can run and schedule those scripts as well as save到目标目的地。 The output of the scripts will be saved to either data lakes and/or azure sql database.脚本的 output 将保存到数据湖和/或 azure sql 数据库中。 Thank you.谢谢你。

There're several services in azure can do this task. azure 中有几个服务可以完成这个任务。

I suggest you can take use of azure webjobs (it supports python as well as support running as per schedule).我建议你可以使用azure webjobs (它支持 python 以及支持按计划运行)。

The rough guidelines are as below:粗略的指导方针如下:

1.Develop your python scripts locally, make sure it can work locally(like extract data from other sources, save to azure database). 1.在本地开发您的 python 脚本,确保它可以在本地工作(如从其他来源提取数据,保存到 azure 数据库)。

2.In azure portal, Create a scheduled WebJob . 2.在 azure 门户中, 创建一个计划的 WebJob During creation, you need to upload the.py file(zip all the files into a.zip file);创建时需要上传.py文件(将所有文件压缩成一个.zip文件); For "Type", please select "Triggered";对于“类型”,请 select “触发”; in the Triggers dropdown, select "Scheduled";在 Triggers 下拉列表中,select “Scheduled”; then specify at which time to run the.py file by using CRON Expression .然后使用CRON Expression指定何时运行 .py 文件。

3.It's done. 3.完成了。

You can also consider other azure services like azure function with time trigger.您还可以考虑其他 azure 服务,例如azure function与时间触发器。 But the webjob is much more easier.但是网络作业要容易得多。

Hope it helps, and also please let me know if you still have more issues about that.希望对您有所帮助,如果您对此还有更多问题,请告诉我。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM