-
Notifications
You must be signed in to change notification settings - Fork 24
feat: Add primary key validation #563
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
Conversation
This will make sure that single resources are validated at the sync stage and wont be passed to desitnations so it wont fail batches in any of CQ destinations.
⏱️ Benchmark results
|
schema/resource.go
Outdated
| // Validates various constraints. for exmaple | ||
| // does all primary keys has values |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| // Validates various constraints. for exmaple | |
| // does all primary keys has values | |
| // Validates various constraints. For example, | |
| // checks that all primary keys have values. |
plugins/source/scheduler_dfs.go
Outdated
| if resolvedResource == nil { | ||
| return | ||
| } | ||
| tableMetrics := p.metrics.TableClient[table.Name][client.ID()] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe this lookup should happen inside the if below it, because that's the only place it's used?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch.
erezrokah
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, nothing blocking
|
|
||
| // Validates various constraints. For example: Does all primary keys has values. | ||
| func (r *Resource) Validate() error { | ||
| for i, c := range r.Table.Columns { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about we don't return early and report in case multiple primary keys are missing instead of only returning the first error?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea. Added.
Co-authored-by: Erez Rokah <erezrokah@users.noreply.github.com>
🤖 I have created a release *beep* *boop* --- ## [1.17.0](v1.16.1...v1.17.0) (2023-01-02) ### Features * Add primary key validation ([#563](#563)) ([09f891a](09f891a)) ### Bug Fixes * **testing:** Sort results before comparison in tests ([#561](#561)) ([587715d](587715d)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
|
FYI, this validation caught an issue in our tests, see cloudquery/cloudquery@5fc8b1f and https://github.com/cloudquery/cloudquery/actions/runs/3828313454/jobs/6513763728#step:7:115 |
No description provided.