-
Notifications
You must be signed in to change notification settings - Fork 81
feat(ibis): introduce the relationship validation #815
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
}, | ||
) | ||
assert response.status_code == 422 | ||
assert response.text is not None |
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.
Could you provide the error message?
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.
well, it should be 204
withou text actually. I provided the wrong input SQL. I'll fix it. Thanks
@@ -197,7 +211,7 @@ def test_validate_with_unknown_rule(): | |||
assert response.status_code == 422 | |||
assert ( | |||
response.text | |||
== "The rule `unknown_rule` is not in the rules, rules: ['column_is_valid']" | |||
== "The rule `unknown_rule` is not in the rules, rules: ['column_is_valid', 'relationship_is_valid']" |
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 importing the rules
from app.model.validator import rules
response.text == f"The rule `unknown_rule` is not in the rules, rules: {rules}"
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.
Sounds great!
) | ||
|
||
assert response.status_code == 422 | ||
assert response.content == b"Relationship not_found not found in manifest" |
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.
You can use response.text
.
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.
LGTM. Thanks @goldmedal.
* implement relationship validation * fix tests for other source * fix the method argument * fix test * fix test * address comment
Description
This PR implements a new validation rule to validate if a relationship is valid. This validation is used to ensure the real data layout matches the definition. We have some rules for different relationship types.
API Request format
Rule name
relationship_is_valid
Request body
Response
The validation result will be shown in the error message:
is_related
: If the count of the join result is greater than 0.left_table_unique
: If the join column of the left table is unique.right_table_unique
: If the join column of the right table is unique.