Find the matching variant for the given db_type and project_type.
(task_name, db_type, project_type)
| 120 | |
| 121 | |
| 122 | def find_matching_variant(task_name, db_type, project_type): |
| 123 | """Find the matching variant for the given db_type and project_type.""" |
| 124 | task_data = get_task_config(task_name) |
| 125 | if not task_data: |
| 126 | return None |
| 127 | |
| 128 | # Check if variants exist |
| 129 | if "variants" not in task_data: |
| 130 | print(f"Error: No variants found in task '{task_name}'") |
| 131 | return None |
| 132 | |
| 133 | variants = task_data["variants"] |
| 134 | |
| 135 | # Find matching variant |
| 136 | for variant in variants: |
| 137 | if variant.get("db_type") == db_type and variant.get("project_type") == project_type: |
| 138 | return variant |
| 139 | |
| 140 | print( |
| 141 | f"Error: No variant found for db_type='{db_type}' and project_type='{project_type}' in task '{task_name}'" |
| 142 | ) |
| 143 | return None |
| 144 | |
| 145 | |
| 146 | def copy_database_file(task_name, variant): |
no test coverage detected