Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[new]: sleep(time ms) #29

Open
2 tasks done
Mmoncadaisla opened this issue Dec 7, 2022 · 4 comments
Open
2 tasks done

[new]: sleep(time ms) #29

Mmoncadaisla opened this issue Dec 7, 2022 · 4 comments
Labels
new-bigfunction Suggest a New BigFunction

Comments

@Mmoncadaisla
Copy link

Check the idea has not already been suggested

Edit the title above with self-explanatory function name and argument names

  • The function name and the argument names I entered in the title above seems self explanatory to me.

BigFunction Description as it would appear in the documentation

Returns NULL after input time (ms)

Examples of (arguments, expected output) as they would appear in the documentation

  • sleep(1000) --> Returns NULL after 1 seconds
  • sleep(60000) --> Returns NULL after 60 seconds
@Mmoncadaisla Mmoncadaisla added the new-bigfunction Suggest a New BigFunction label Dec 7, 2022
@shivam221098
Copy link
Contributor

Hi 👋,

Can you add some more background to this function?
i.e.

  1. What's the significance of adding a delay in query execution?
  2. What use cases you're thinking of for using this sleep?

@AntoineGiraud
Copy link
Contributor

AntoineGiraud commented Jul 26, 2024

This function was added in décember 2023 :

bigfunctions.eu.sleep(10)

where sleep function get's seconds in param (not ms)
i guess it covers this current need ?!

@AntoineGiraud
Copy link
Contributor

@shivam221098,
example of use case :

  • propagating descriptions on columns from an other query ...
    where you can only do 5 DDL per 10 seconds !
    image

example :

DECLARE i INT64 DEFAULT 5;
FOR sql_alter_descr in (/* {select generating DDL alter table column set options descriptions commands } */)
DO
  execute immediate sql_alter_descr.sql;
  SET i = i + 1;
  IF (i>=5) THEN
    -- sleep of 10s every 5 DDL edits on a table
    CALL bigfunctions.eu.sleep(10);
    SET i = 0;
  END IF;
END FOR;

@shivam221098
Copy link
Contributor

@AntoineGiraud
That's great. That made sense.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new-bigfunction Suggest a New BigFunction
Projects
None yet
Development

No branches or pull requests

3 participants