mirror of
				https://github.com/open-metadata/OpenMetadata.git
				synced 2025-10-31 02:29:03 +00:00 
			
		
		
		
	
		
			
	
	
		
			44 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
		
		
			
		
	
	
			44 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
|   | import sys | ||
|  | 
 | ||
|  | import pytest | ||
|  | 
 | ||
|  | from metadata.workflow.metadata import MetadataWorkflow | ||
|  | from metadata.workflow.usage import UsageWorkflow | ||
|  | 
 | ||
|  | if not sys.version_info >= (3, 9): | ||
|  |     pytest.skip("requires python 3.9+", allow_module_level=True) | ||
|  | 
 | ||
|  | 
 | ||
|  | @pytest.fixture() | ||
|  | def usage_config(db_service, workflow_config): | ||
|  |     return { | ||
|  |         "source": { | ||
|  |             "type": "mssql-usage", | ||
|  |             "serviceName": db_service.fullyQualifiedName.root, | ||
|  |             "sourceConfig": { | ||
|  |                 "config": { | ||
|  |                     "queryLogDuration": 2, | ||
|  |                     "resultLimit": 1000, | ||
|  |                     "databaseFilterPattern": {"includes": ["TestDB", "AdventureWorks"]}, | ||
|  |                 }, | ||
|  |             }, | ||
|  |         }, | ||
|  |         "processor": {"type": "query-parser", "config": {}}, | ||
|  |         "stage": {"type": "table-usage", "config": {"filename": "/tmp/mssql_usage"}}, | ||
|  |         "bulkSink": { | ||
|  |             "type": "metadata-usage", | ||
|  |             "config": {"filename": "/tmp/mssql_usage"}, | ||
|  |         }, | ||
|  |         "workflowConfig": workflow_config, | ||
|  |     } | ||
|  | 
 | ||
|  | 
 | ||
|  | def test_usage( | ||
|  |     patch_passwords_for_db_services, | ||
|  |     run_workflow, | ||
|  |     ingestion_config, | ||
|  |     usage_config, | ||
|  | ): | ||
|  |     run_workflow(MetadataWorkflow, ingestion_config) | ||
|  |     run_workflow(UsageWorkflow, usage_config) |