app开发者平台在数字化时代的重要性与发展趋势解析
802
2022-10-22
Hydro- 数据 API 操作和服务框架
Hydro 是一个 Python 的开源数据 API 操作和服务框架。主要帮助 Web 服务和其他数据消费者从不同的数据流中抽取数据,并在线处理。
示例代码:
#creating a plan objectplan = PlanObject(params, source_id, conf)# defining data source and typeplan.data_source = 'vertica-dash'plan.source_type = Configurator.VERTICA# time diff based on input paramstime_diff = (plan.TO_DATE - plan.FROM_DATE).total_seconds()# if time range is bigger than 125 days and application type is dashboard, abort!# since data need to be fetched quicklyif time_diff > Configurator.SECONDS_IN_DAY*125 and params['APP_TYPE'].to_string() == 'Dashboard':raise HydroException('Time range is too big')# else, if average records per day is bigger than 1000 or client is convertro then run sample logicelif plan.AVG_RECORDS_PER_DAY > 1000 or params['CLIENT_ID'].to_string() == 'convertro':plan.template_file = 'device_grid_widget_sampling.sql'plan.sampling = Trueself.logger.debug('Sampling for the query has been turn on')# else run other logicelse:plan.template_file = 'device_grid_widget.sql'#return plan object to the query enginereturn plan
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。
发表评论
暂时没有评论,来抢沙发吧~