docs(guide): add example for adding user in DataHub (#3682)

This commit is contained in:
Aseem Bansal 2021-12-10 11:02:09 +05:30 committed by GitHub
parent b00fe8426e
commit 1e97ac6cf7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 100 additions and 3 deletions

View File

@ -100,6 +100,14 @@ module.exports = {
"docs/lineage/sample_code",
],
},
{
Guides: [
"metadata-ingestion/adding-source",
"docs/how/add-custom-ingestion-source",
"docs/how/add-custom-data-platform",
"docs/how/add-user-data",
],
},
],
"Metadata Modeling": [
"docs/modeling/metadata-model",
@ -184,7 +192,6 @@ module.exports = {
// TODO: the titles of these should not be in question form in the sidebar
"docs/developers",
"docs/docker/development",
"metadata-ingestion/adding-source",
{
type: "doc",
label: "Ingesting files from S3",
@ -206,8 +213,6 @@ module.exports = {
"docs/how/delete-metadata",
"datahub-web-react/src/app/analytics/README",
"metadata-ingestion/developing",
"docs/how/add-custom-data-platform",
"docs/how/add-custom-ingestion-source",
{
"Module READMEs": [
"datahub-web-react/README",

92
docs/how/add-user-data.md Normal file
View File

@ -0,0 +1,92 @@
# Adding user in DataHub
This guide shares how you can add user metadata in DataHub. Usually you would want to use one of our sources for ingesting user metadata. But if there is no connector for your use case then you would want to use this guide.
:::note
This does not allow you add new users for Authentication. If you want to add a new user in DataHub for Login please refer to [JaaS Authentication](./auth/jaas.md)
:::
You can look at all aspects supported for users in [CorpUserAspect](../../metadata-models/src/main/pegasus/com/linkedin/metadata/aspect/CorpUserAspect.pdl)
## Using File-Based Ingestion Recipe
Define a JSON File containing your user
```my-user.json
[
{
"auditHeader": null,
"proposedSnapshot": {
"com.linkedin.pegasus2avro.metadata.snapshot.CorpUserSnapshot": {
"urn": "urn:li:corpuser:aseem.bansal",
"aspects": [
{
"com.linkedin.pegasus2avro.identity.CorpUserInfo": {
"active": true,
"displayName": {
"string": "Aseem Bansal"
},
"email": "aseem+examples@acryl.io",
"title": {
"string": "Software Engineer"
},
"managerUrn": null,
"departmentId": null,
"departmentName": null,
"firstName": null,
"lastName": null,
"fullName": {
"string": "Aseem Bansal"
},
"countryCode": null
}
}
]
}
}
}
]
```
Define an [ingestion recipe](https://datahubproject.io/docs/metadata-ingestion/#recipes)
```
---
# see https://datahubproject.io/docs/metadata-ingestion/source_docs/file for complete documentation
source:
type: "file"
config:
filename: "./my-user.json"
# see https://datahubproject.io/docs/metadata-ingestion/sink_docs/datahub for complete documentation
sink:
...
```
Use [DataHub CLI](../cli.md) to do the ingestion.
## Using Rest.li API
```
curl 'http://localhost:8080/entities?action=ingest' -X POST --data '{
"entity": {
"value": {
"com.linkedin.metadata.snapshot.CorpUserSnapshot": {
"urn": "urn:li:corpuser:aseem.bansal",
"aspects": [{
"com.linkedin.identity.CorpUserInfo": {
"active": true,
"displayName": "Aseem Bansal",
"email": "aseem+example@acryl.io",
"title": "Software Engineer",
"fullName": "Aseem Bansal"
}
}]
}
}
}
}'
```