-
Notifications
You must be signed in to change notification settings - Fork 88
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
feat: Create users in metadata backend via API #289
Conversation
…a API. Signed-off-by: Grant Seward <grant@stemma.ai>
Signed-off-by: Grant Seward <grant@stemma.ai>
Signed-off-by: Grant Seward <grant@stemma.ai>
LGTM pending a test! |
Signed-off-by: Grant Seward <grant@stemma.ai>
Signed-off-by: Grant Seward <grant@stemma.ai>
Codecov Report
@@ Coverage Diff @@
## master #289 +/- ##
==========================================
+ Coverage 74.10% 76.06% +1.95%
==========================================
Files 25 27 +2
Lines 1255 1483 +228
Branches 136 180 +44
==========================================
+ Hits 930 1128 +198
+ Misses 297 296 -1
- Partials 28 59 +31
Continue to review full report at Codecov.
|
|
||
user_result = result.single() | ||
if not user_result: | ||
raise RuntimeError('Failed to create user with data %s' % user_data) |
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.
I don't think this should be a RuntimeError since no result existing would likely be an issue with neo4j, not this program.
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.
I think that's a fair point. This specific error was used to keep in line with the existing paradigm for how Neo4j integration errors are raised, e.g.:
- https://github.com/amundsen-io/amundsenmetadatalibrary/blob/master/metadata_service/proxy/neo4j_proxy.py#L403
- https://github.com/amundsen-io/amundsenmetadatalibrary/blob/master/metadata_service/proxy/neo4j_proxy.py#L499
There are 6-7 places where this is used the the thought was that reusing this exception would make it easier to catch and handle these errors if we only need to watch for one type of exception.
Given this, if you'd like to continue with a more descriptive exception hat are your thoughts on something akin to a Neo4jErrorException
class and raise that here in place of the RuntimeError
the code above (with migration of other runtime errors to this new exception occurring through a refactor in the future)?
Signed-off-by: Grant Seward <grant@stemma.ai>
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.
Summary of Changes
PUT
method for the user details API resourceThis implementation heavily relies on the validation and pre-processing being done as part of
UserSchema().load({...})
to validate the inputs of the data provided in the API. As new fields / validation rules are added to the User schema there should hopefully not be any changes to this API. When invoking the API any number of fields can be provided as long as the minimum required fields are provided.Sample invocations
To invoke the API directly, locally:
Similarly, an invalid payload will return the reason why:
To invoke from the amundsen frontend:
Tests
Documentation
swagger_doc/user/detail_put.yml
CheckList
Make sure you have checked all steps below to ensure a timely review.
make test