如何使用gspread保存来自https://docs.google.com/spreadsheets/的数据(例如,如果您有更好的方法,请告诉我们),以便将其传输到clickhouse数据库(我使用气流中的dag控制etl)
文档中的答案对于新手来说不是很清楚,是否有分步指南
只需在控制台Python中获取数据,我可以,但这里介绍了如何保存这些数据,因为您需要每天定期提取一次数据(间歇性只是气流的工作-我知道怎么做)
我假设您需要连接到clickhouse,这将是一个来自文件的数据流,该文件每天在气流端生成一个Python脚本,将来通过https发送到clickhouse。你有一个循序渐进的教程吗
或者什么是用于此目的的最佳技术
实际上,我的代码看起来是这样的(我认为首先要学习如何在区域设置中获取它,然后将其包装在dag中以自动启动脚本)
import gspread
from oauth2client.service_account import ServiceAccountCredentials
import pprint
scope = ['https://spreadsheets.google.com/feeds']
creds = ServiceAccountCredentials.from_json_keyfile_name('client_secret.json',scope)
client = gspread.authorize(creds)
sheet = client.open('Data base').sheet4
result = sheet.get_all_records()
print(result)
#in advance I apologize to the elders for the question from a novice
目前没有回答
相关问题 更多 >
编程相关推荐