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 empty_result_state attribute to the databricks_sql_alert resource #2724

Merged
merged 1 commit into from
Oct 6, 2023

Conversation

alexott
Copy link
Contributor

@alexott alexott commented Sep 26, 2023

Changes

This fixes #2662

Tests

  • make test run locally
  • relevant change in docs/ folder
  • tested manually
  • covered with integration tests in internal/acceptance
  • relevant acceptance tests are passing
  • using Go SDK

// This is a workaround for Go SDK problem, will be fixed there.
var err error
if a.Options.EmptyResultState != "" {
err = ca.Options.EmptyResultState.Set(a.Options.EmptyResultState)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should throw an error if the value is not supported

Currently supported values are unknown, triggered, ok

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The check should be done on the backend. The main problem right now is that I can't simply do ca.Options.EmptyResultState.Set(a.Options.EmptyResultState) if the value is omitted - SDK returns an error.

@@ -46,14 +47,18 @@ func (a *AlertEntity) toCreateAlertApiObject(s map[string]*schema.Schema, data *
Op: a.Options.Op,
Value: a.Options.Value,
}

return ca, nil
// This is a workaround for Go SDK problem, will be fixed there.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which problem is this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem with SDK that it doesn't accept empty string for optional enums

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@codecov-commenter
Copy link

codecov-commenter commented Oct 6, 2023

Codecov Report

Merging #2724 (152a84c) into master (364512f) will decrease coverage by 0.04%.
The diff coverage is 40.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2724      +/-   ##
==========================================
- Coverage   84.82%   84.78%   -0.04%     
==========================================
  Files         148      148              
  Lines       12991    12998       +7     
==========================================
+ Hits        11019    11020       +1     
- Misses       1378     1384       +6     
  Partials      594      594              
Files Coverage Δ
sql/resource_sql_alerts.go 31.77% <40.00%> (-1.23%) ⬇️

@alexott alexott added this pull request to the merge queue Oct 6, 2023
@alexott alexott removed this pull request from the merge queue due to a manual request Oct 6, 2023
@alexott alexott enabled auto-merge October 6, 2023 06:20
@alexott alexott added this pull request to the merge queue Oct 6, 2023
Merged via the queue into master with commit f7739a5 Oct 6, 2023
7 checks passed
@alexott alexott deleted the issue-2662 branch October 6, 2023 06:27
@tanmay-db tanmay-db mentioned this pull request Oct 12, 2023
5 tasks
@junwei-db
Copy link

@alexott I noticed the documentation for this change is incorrect -- the new empty_result_state attribute should be specified under databricks_sql_alert.options, not directly under databricks_sql_alert. Could you help fix this? Thanks

@alexott
Copy link
Contributor Author

alexott commented Oct 24, 2023

@junwei-db it's just a doc problem, implementation is in the correct place

@junwei-db
Copy link

Right, that's what I was referring to. Could you help fix the doc?

@alexott
Copy link
Contributor Author

alexott commented Oct 24, 2023

See #2834

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEATURE] Support default DBSQL alert state when query returns empty results
4 participants