mirror of
				https://github.com/datahub-project/datahub.git
				synced 2025-10-31 10:49:00 +00:00 
			
		
		
		
	 918718e7d0
			
		
	
	
		918718e7d0
		
			
		
	
	
	
	
		
			
			Co-authored-by: Hyejin Yoon <yoonhyejin@Hyejins-MacBook-Pro.local> Co-authored-by: Shirshanka Das <shirshanka@apache.org>
		
			
				
	
	
		
			28 lines
		
	
	
		
			759 B
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			28 lines
		
	
	
		
			759 B
		
	
	
	
		
			Python
		
	
	
	
	
	
| import logging
 | |
| 
 | |
| from datahub.api.entities.corpuser.corpuser import CorpUser, CorpUserGenerationConfig
 | |
| from datahub.ingestion.graph.client import DataHubGraph, DataHubGraphConfig
 | |
| 
 | |
| log = logging.getLogger(__name__)
 | |
| logging.basicConfig(level=logging.INFO)
 | |
| 
 | |
| user_email = "bar@acryl.io"
 | |
| 
 | |
| user: CorpUser = CorpUser(
 | |
|     id=user_email,
 | |
|     display_name="The Bar",
 | |
|     email=user_email,
 | |
|     title="Software Engineer",
 | |
|     first_name="The",
 | |
|     last_name="Bar",
 | |
|     full_name="The Bar",
 | |
| )
 | |
| 
 | |
| # Create graph client
 | |
| datahub_graph = DataHubGraph(DataHubGraphConfig(server="http://localhost:8080"))
 | |
| for event in user.generate_mcp(
 | |
|     generation_config=CorpUserGenerationConfig(override_editable=False)
 | |
| ):
 | |
|     datahub_graph.emit(event)
 | |
| log.info(f"Upserted user {user.urn}")
 |