MCPcopy Create free account
hub / github.com/dbt-labs/ade-bench / main

Function main

scripts_python/create_sandbox.py:311–387  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

309
310
311def main():
312 parser = argparse.ArgumentParser(description="Create a sandbox environment from a task")
313 parser.add_argument("--task", help="Name of the task to create sandbox for")
314 parser.add_argument(
315 "--db", required=True, help="Database type (duckdb, sqlite, postgres, snowflake)"
316 )
317 parser.add_argument("--project-type", required=True, help="Project type (dbt, other)")
318
319 args = parser.parse_args()
320
321 task_name = args.task
322 db_type = args.db
323 project_type = args.project_type
324
325 print(f"Creating sandbox for task: {task_name}")
326 print(f"Database type: {db_type}")
327 print(f"Project type: {project_type}")
328 print("-" * 50)
329
330 # Step 1: Check if task exists
331 if not check_task_exists(task_name):
332 sys.exit(1)
333
334 print(f"✓ Task '{task_name}' found")
335
336 # Step 2: Find matching variant
337 variant = find_matching_variant(task_name, db_type, project_type)
338 if not variant:
339 sys.exit(1)
340
341 print(
342 f"✓ Found matching variant: db_name='{variant['db_name']}', project_name='{variant['project_name']}'"
343 )
344 if "migration_directory" in variant:
345 print(f"✓ Migration directory: {variant['migration_directory']}")
346
347 # Step 3: Wipe sandbox directory
348 if not wipe_sandbox_directory():
349 sys.exit(1)
350
351 # Step 4: Copy shared project contents
352 if not copy_project_contents(task_name, variant):
353 sys.exit(1)
354
355 # Step 5: Copy database file
356 if not copy_database_file(task_name, variant):
357 sys.exit(1)
358
359 # Step 6: Copy migration files (if specified)
360 if not copy_migration_files(variant):
361 sys.exit(1)
362
363 # Step 7: Copy task files (scripts, seeds, tests)
364 if not copy_task_files(task_name):
365 sys.exit(1)
366
367 # Step 8: Copy shared scripts
368 if not copy_shared_scripts():

Callers 1

create_sandbox.pyFile · 0.70

Calls 9

check_task_existsFunction · 0.85
find_matching_variantFunction · 0.85
wipe_sandbox_directoryFunction · 0.85
copy_project_contentsFunction · 0.85
copy_database_fileFunction · 0.85
copy_migration_filesFunction · 0.85
copy_task_filesFunction · 0.85
copy_shared_scriptsFunction · 0.85
update_dbt_configFunction · 0.85

Tested by

no test coverage detected