mirror of
				https://github.com/open-metadata/OpenMetadata.git
				synced 2025-10-31 18:48:35 +00:00 
			
		
		
		
	 449a5f2de3
			
		
	
	
		449a5f2de3
		
			
		
	
	
	
	
		
			
			* feat: add global metric configuration for the profiler * style: ran java linting * fix: renamed disable to disabled * style: ran java linting * feat: ometa sdk for profiler setting * test: ingestion profiler global config tests * fix: update metric name to use MetricType Enum * fix: allow bot to retrieve settings * fix: exclude GX artifacts * feat: implement global profiler setting logic for ingestion side * fix: exclude metrics if Metric is empty * style: ran python linting * style: ran python linting * fix: skip empty metrics * style: ran python linting * fix: moved GET profiler config to seperate endpoint in system resource * fix: moved compute metric filter to MetricFilter + renamed container * fix: test failures * fix: profiler test case
		
			
				
	
	
		
			49 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			49 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
| """SQLAlchemy utilities for testing purposes."""
 | |
| 
 | |
| from typing import Sequence
 | |
| 
 | |
| from sqlalchemy import Column, Integer, String, create_engine
 | |
| from sqlalchemy.orm import Session, declarative_base
 | |
| from sqlalchemy.orm.decl_api import DeclarativeMeta
 | |
| 
 | |
| Base = declarative_base()
 | |
| 
 | |
| 
 | |
| class User(Base):
 | |
|     __tablename__ = "users"
 | |
|     id = Column(Integer, primary_key=True)
 | |
|     name = Column(String(256))
 | |
|     fullname = Column(String(256))
 | |
|     nickname = Column(String(256))
 | |
|     age = Column(Integer)
 | |
| 
 | |
| 
 | |
| class SQATestUtils:
 | |
|     def __init__(self, connection_url: str):
 | |
|         self.connection_url = connection_url
 | |
|         self.engine = create_engine(connection_url)
 | |
|         self.session = Session(self.engine)
 | |
| 
 | |
|     def load_data(self, data: Sequence[DeclarativeMeta]):
 | |
|         """load data into the database using sqlalchemy ORM
 | |
| 
 | |
|         Args:
 | |
|             data List[DeclarativeMeta]: list of ORM objects to load
 | |
|         """
 | |
|         self.session.add_all(data)
 | |
|         self.session.commit()
 | |
| 
 | |
|     def load_user_data(self):
 | |
|         data = [
 | |
|             User(name="John", fullname="John Doe", nickname="johnny b goode", age=30),  # type: ignore
 | |
|             User(name="Jane", fullname="Jone Doe", nickname=None, age=31),  # type: ignore
 | |
|         ] * 20
 | |
|         self.load_data(data)
 | |
| 
 | |
|     def create_user_table(self):
 | |
|         User.__table__.create(bind=self.session.get_bind())
 | |
| 
 | |
|     def close(self):
 | |
|         self.session.close()
 | |
|         self.engine.dispose()
 |