mirror of
				https://github.com/open-metadata/OpenMetadata.git
				synced 2025-10-31 18:48:35 +00:00 
			
		
		
		
	 60de33d7cf
			
		
	
	
		60de33d7cf
		
			
		
	
	
	
	
		
			
			* fix: optimize system metrics retrieval for memory * fix: ran python linting * fix: logic to retrieve unique system metrics operations * fix: added logic to clean up query before parsing it * fix: added E2E tests for rds, bq, snflk system metrics * fix: ran python linting * fix: fix postgres query + add default byte size to env var * fix: ran python linting
		
			
				
	
	
		
			43 lines
		
	
	
		
			1.6 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			43 lines
		
	
	
		
			1.6 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
| #  Copyright 2022 Collate
 | |
| #  Licensed under the Apache License, Version 2.0 (the "License");
 | |
| #  you may not use this file except in compliance with the License.
 | |
| #  You may obtain a copy of the License at
 | |
| #  http://www.apache.org/licenses/LICENSE-2.0
 | |
| #  Unless required by applicable law or agreed to in writing, software
 | |
| #  distributed under the License is distributed on an "AS IS" BASIS,
 | |
| #  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 | |
| #  See the License for the specific language governing permissions and
 | |
| #  limitations under the License.
 | |
| 
 | |
| """
 | |
| Add Common E2E Sqlalchemy Mixins
 | |
| """
 | |
| 
 | |
| 
 | |
| class SQACommonMethods:
 | |
|     def create_table_and_view(self) -> None:
 | |
|         with self.engine.connect() as connection:
 | |
|             connection.execute(self.create_table_query)
 | |
|             for insert_query in self.insert_data_queries:
 | |
|                 connection.execute(insert_query)
 | |
|             connection.execute(self.create_view_query)
 | |
|             connection.close()
 | |
| 
 | |
|     def delete_table_and_view(self) -> None:
 | |
|         with self.engine.connect() as connection:
 | |
|             connection.execute(self.drop_view_query)
 | |
|             connection.execute(self.drop_table_query)
 | |
|             connection.close()
 | |
| 
 | |
|     def run_update_queries(self) -> None:
 | |
|         with self.engine.connect() as connection:
 | |
|             for update_query in self.update_queries():
 | |
|                 connection.execute(update_query)
 | |
|             connection.close()
 | |
| 
 | |
|     def run_delete_queries(self) -> None:
 | |
|         with self.engine.connect() as connection:
 | |
|             for drop_query in self.delete_queries():
 | |
|                 connection.execute(drop_query)
 | |
|             connection.close()
 |