1
Help us understand the problem. What are the problem?

More than 1 year has passed since last update.

posted at

updated at

Organization

BigQuery Scriptingでsleep

BigQuery Scriptingで処理を書いている途中で、少しだけ待ち時間を挟みたいことがたまにあります。
そんな時用のsleep処理をprocedureとして書いてみました。

CREATE OR REPLACE PROCEDURE `<プロジェクト名>.<データセット名>.sleep`(IN sec INT64)
BEGIN
  DECLARE now TIMESTAMP DEFAULT CURRENT_TIMESTAMP();
  DECLARE finish TIMESTAMP DEFAULT TIMESTAMP_ADD(CURRENT_TIMESTAMP(), INTERVAL sec SECOND);

  WHILE now < finish DO
    SET now = CURRENT_TIMESTAMP();
  END WHILE;
END;
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Sign upLogin
1
Help us understand the problem. What are the problem?