-
Notifications
You must be signed in to change notification settings - Fork 399
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
"sql: no rows in result set" error #188
Comments
We are also experiencing this bug. |
I think what we need to do is set the id of unfound resources to "", which will effectively remove them from the state for you. I don't have a good way to test this though. @pwnage101 do you have a reproducible failure here? |
Leaving more note here in case someone wants to pick this work up - it seems that in our read paths we need to figure out errors that mean "resource doesn't exist" and in those cases call Example of what I am talking about from the aws provider (reading that provider is how I figure out how to do things in providers. |
…s#339) This PR is a redo of Snowflake-Labs#305, since it was missing tests and some resources were not working. Fixes Snowflake-Labs#188 Co-authored-by: Edwin De Jong <edwin.de.jong@bigdatarepublic.nl> Co-authored-by: Ryan King <rking@chanzuckerberg.com>
…s#339) This PR is a redo of Snowflake-Labs#305, since it was missing tests and some resources were not working. Fixes Snowflake-Labs#188 Co-authored-by: Edwin De Jong <edwin.de.jong@bigdatarepublic.nl> Co-authored-by: Ryan King <rking@chanzuckerberg.com>
…s#339) This PR is a redo of Snowflake-Labs#305, since it was missing tests and some resources were not working. Fixes Snowflake-Labs#188 Co-authored-by: Edwin De Jong <edwin.de.jong@bigdatarepublic.nl> Co-authored-by: Ryan King <rking@chanzuckerberg.com>
Happening here with a terraform import |
We occasionally encounter this error when trying to run
plan
/refresh
after a failedapply
(e.g. can happen if the computer runningapply
gets terminated or if snowflake throws an error in the middle of an apply, like if we're trying to make terraform create an object that already exists...there are many reasons why anapply
will error out without cleaning itself up):We typically remedy the issue by deleting grants from the state that don't exist in Snowflake, but it can be extremely difficult to manually find those instances since our terraform state has thousands of resources.
I think there's some grant-related code in the provider that is running a SQL query to get a list of grants and just blindly expecting the result to be non-empty. I think the provider needs to handle this more elegantly, because I would hope that terraform
refresh
should be more robust since it is a prerequisite to running terraformplan
andapply
.Aside: It is no surprise that the state is corrupt, since we ARE talking about the
apply
unexpectedly exiting or getting terminated. So I agree that there are other provider bugs and issues with our infrastructure which must first exist and have happened before we encounter this bug, but I would rather treat those as separate bugs. Since this happens to us so often and it's always the same error, I feel like fixing this is the low-hanging fruit.The text was updated successfully, but these errors were encountered: