快速的數據操作框架:Hydro
Hydro是一個免費和開源的數據 API 計算和服務框架,設計幫助 Web/應用服務器和其他數據消費者從不同的數據流中抽取數據,并快速處理。然后基于標準和統計數據呈現給不同的客戶端/應用程序。
|-------| | DB1 |====== |-------| = . = Data API = |-----------| . = > | HYDRO - | |---------| = | Extract | | APP/Web | |--------| ===ETL===> . = | Transform | =====> | Server | =====> | Client | = > | Render | |---------| |--------| . = |-----------| = |-------| = | DBn |====== |-------|
#creating a plan object plan = PlanObject(params, source_id, conf) # defining data source and type plan.data_source = 'vertica-dash' plan.source_type = Configurator.VERTICA # time diff based on input params time_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 quickly if 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 logic elif plan.AVG_RECORDS_PER_DAY > 1000 or params['CLIENT_ID'].to_string() == 'convertro': plan.template_file = 'device_grid_widget_sampling.sql' plan.sampling = True self.logger.debug('Sampling for the query has been turn on') # else run other logic else: plan.template_file = 'device_grid_widget.sql' #return plan object to the query engine return plan
本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!