:daily_company_scores columns %w[:day, :company_id, :score] mode :update, [:day] end schedule do frequency :daily end run :bq, <<SQL SELECT DATE(_WT_SCHEDULED_TIME, "+9") AS day, company_id, SUM(action_score) AS score FROM `log.company_actions*` WHERE _TABLE_SUFFIX = FORMAT_TIMESTAMP("%Y%m%d", TIMESTAMP_SUB(_WT_SCHEDULED_TIME, INTERVAL 1 DAY), "+9") GROUP BY company_id SQL run :bq, <<SQL SELECT DATE(_WT_SCHEDULED_TIME, "+9") AS day, company_id, SUM(action_score) AS score FROM `log.company_actions*` WHERE _TABLE_SUFFIX = FORMAT_TIMESTAMP("%Y%m%d", TIMESTAMP_SUB(_WT_SCHEDULED_TIME, INTERVAL 1 DAY), "+9") GROUP BY company_id SQL # BigQuery ͷΫΤϦͷ࣮ߦ