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

Add table snowflake_resource_monitors #7

Closed
paulsewardasc opened this issue May 5, 2022 · 4 comments
Closed

Add table snowflake_resource_monitors #7

paulsewardasc opened this issue May 5, 2022 · 4 comments
Assignees
Labels
enhancement New feature or request new table New table request

Comments

@paulsewardasc
Copy link
Contributor

We us resource monitors to see how many credits have been used, I would like to graph this to show if the slope is changing or if we are near to out limit. "SHOW RESOURCE MONITORS" does this.
table_snowflake_resource_monitor.txt

@paulsewardasc paulsewardasc added enhancement New feature or request new table New table request labels May 5, 2022
@cbruno10
Copy link
Contributor

cbruno10 commented May 5, 2022

@paulsewardasc Thanks for raising this feature request!

I see you attached a file with some Go code inside, is this code you're currently using to query these resource types in a locally built plugin? I'm not familiar with that particular API or resource type yet, but I took a look at the code and it seemed to be directionally correct.

If it's something you're comfortable contributing, we'd really appreciate a new PR adding that table along with its doc with examples (which can be based off of how you use the table today). We'd be more than happy to provide feedback and review comments in that PR as well.

If this is something you're interested (or not) in contributing, please let us know!

@cbruno10 cbruno10 self-assigned this May 5, 2022
@paulsewardasc
Copy link
Contributor Author

Hi, I am using this code, it seems to work well. I will get some examples together and document. Not sure how to add a new PR though.

Paul

@paulsewardasc
Copy link
Contributor Author

paulsewardasc commented May 6, 2022

select account as "Account",
    name as "Warehouse", 
    credit_quota as "Credit Quota",
    used_credits as "Used Credits",
    remaining_credits as "Remaining Credits",
    to_char(used_credits/credit_quota*100,'9990D9') as "% Used",
    case
        when used_credits/credit_quota*100 > 90 then 'alert'
        when used_credits/credit_quota*100 > 75 then 'warning'
        else 'ok'
    end as type
from snowflake_resource_monitor
where used_credits/credit_quota*100 > 75
order by used_credits/credit_quota desc

@e-gineer
Copy link

e-gineer commented May 6, 2022

Thanks so much for the contribution @paulsewardasc!

Pull requests are great for review / collaborating in open source and also mean that you’ll be recognized through your commits as a contributor to the project. If you’d like to learn more about how to do a PR here is a good guide https://www.freecodecamp.org/news/how-to-make-your-first-pull-request-on-github-3/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request new table New table request
Projects
None yet
Development

No branches or pull requests

3 participants