airbyte-internal-ops 0.2.4__py3-none-any.whl → 0.3.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -360,6 +360,305 @@ SELECT_SUCCESSFUL_SYNCS_FOR_VERSION = sqlalchemy.text(
360
360
  """
361
361
  )
362
362
 
363
+ # Get recent sync results for ALL actors using a SOURCE connector definition.
364
+ # Finds all actors with the given actor_definition_id and returns their sync attempts,
365
+ # regardless of whether they have explicit version pins.
366
+ # Query starts from jobs table to leverage indexed columns.
367
+ # The LEFT JOIN to scoped_configuration provides pin context when available (pin_origin_type,
368
+ # pin_origin, pinned_version_id will be NULL for unpinned actors).
369
+ # Status filtering ('all', 'succeeded', 'failed') is handled at the application layer by
370
+ # selecting among different SQL query constants; this query returns all statuses.
371
+ SELECT_RECENT_SYNCS_FOR_SOURCE_CONNECTOR = sqlalchemy.text(
372
+ """
373
+ SELECT
374
+ jobs.id AS job_id,
375
+ jobs.scope AS connection_id,
376
+ jobs.status AS job_status,
377
+ jobs.started_at AS job_started_at,
378
+ jobs.updated_at AS job_updated_at,
379
+ connection.name AS connection_name,
380
+ actor.id AS actor_id,
381
+ actor.name AS actor_name,
382
+ actor.actor_definition_id,
383
+ actor.tombstone AS actor_tombstone,
384
+ workspace.id AS workspace_id,
385
+ workspace.name AS workspace_name,
386
+ workspace.organization_id,
387
+ workspace.dataplane_group_id,
388
+ dataplane_group.name AS dataplane_name,
389
+ scoped_configuration.origin_type AS pin_origin_type,
390
+ scoped_configuration.origin AS pin_origin,
391
+ scoped_configuration.value AS pinned_version_id
392
+ FROM jobs
393
+ JOIN connection
394
+ ON jobs.scope = connection.id::text
395
+ AND connection.status != 'deprecated'
396
+ JOIN actor
397
+ ON connection.source_id = actor.id
398
+ AND actor.actor_definition_id = :connector_definition_id
399
+ AND actor.tombstone = false
400
+ JOIN workspace
401
+ ON actor.workspace_id = workspace.id
402
+ AND workspace.tombstone = false
403
+ LEFT JOIN dataplane_group
404
+ ON workspace.dataplane_group_id = dataplane_group.id
405
+ LEFT JOIN scoped_configuration
406
+ ON scoped_configuration.scope_id = actor.id
407
+ AND scoped_configuration.key = 'connector_version'
408
+ AND scoped_configuration.scope_type = 'actor'
409
+ WHERE
410
+ jobs.config_type = 'sync'
411
+ AND jobs.updated_at >= :cutoff_date
412
+ ORDER BY
413
+ jobs.updated_at DESC
414
+ LIMIT :limit
415
+ """
416
+ )
417
+
418
+ # Same as above but filtered to only successful syncs
419
+ SELECT_RECENT_SUCCESSFUL_SYNCS_FOR_SOURCE_CONNECTOR = sqlalchemy.text(
420
+ """
421
+ SELECT
422
+ jobs.id AS job_id,
423
+ jobs.scope AS connection_id,
424
+ jobs.status AS job_status,
425
+ jobs.started_at AS job_started_at,
426
+ jobs.updated_at AS job_updated_at,
427
+ connection.name AS connection_name,
428
+ actor.id AS actor_id,
429
+ actor.name AS actor_name,
430
+ actor.actor_definition_id,
431
+ actor.tombstone AS actor_tombstone,
432
+ workspace.id AS workspace_id,
433
+ workspace.name AS workspace_name,
434
+ workspace.organization_id,
435
+ workspace.dataplane_group_id,
436
+ dataplane_group.name AS dataplane_name,
437
+ scoped_configuration.origin_type AS pin_origin_type,
438
+ scoped_configuration.origin AS pin_origin,
439
+ scoped_configuration.value AS pinned_version_id
440
+ FROM jobs
441
+ JOIN connection
442
+ ON jobs.scope = connection.id::text
443
+ AND connection.status != 'deprecated'
444
+ JOIN actor
445
+ ON connection.source_id = actor.id
446
+ AND actor.actor_definition_id = :connector_definition_id
447
+ AND actor.tombstone = false
448
+ JOIN workspace
449
+ ON actor.workspace_id = workspace.id
450
+ AND workspace.tombstone = false
451
+ LEFT JOIN dataplane_group
452
+ ON workspace.dataplane_group_id = dataplane_group.id
453
+ LEFT JOIN scoped_configuration
454
+ ON scoped_configuration.scope_id = actor.id
455
+ AND scoped_configuration.key = 'connector_version'
456
+ AND scoped_configuration.scope_type = 'actor'
457
+ WHERE
458
+ jobs.config_type = 'sync'
459
+ AND jobs.status = 'succeeded'
460
+ AND jobs.updated_at >= :cutoff_date
461
+ ORDER BY
462
+ jobs.updated_at DESC
463
+ LIMIT :limit
464
+ """
465
+ )
466
+
467
+ # Same as above but filtered to only failed syncs
468
+ SELECT_RECENT_FAILED_SYNCS_FOR_SOURCE_CONNECTOR = sqlalchemy.text(
469
+ """
470
+ SELECT
471
+ jobs.id AS job_id,
472
+ jobs.scope AS connection_id,
473
+ jobs.status AS job_status,
474
+ jobs.started_at AS job_started_at,
475
+ jobs.updated_at AS job_updated_at,
476
+ connection.name AS connection_name,
477
+ actor.id AS actor_id,
478
+ actor.name AS actor_name,
479
+ actor.actor_definition_id,
480
+ actor.tombstone AS actor_tombstone,
481
+ workspace.id AS workspace_id,
482
+ workspace.name AS workspace_name,
483
+ workspace.organization_id,
484
+ workspace.dataplane_group_id,
485
+ dataplane_group.name AS dataplane_name,
486
+ scoped_configuration.origin_type AS pin_origin_type,
487
+ scoped_configuration.origin AS pin_origin,
488
+ scoped_configuration.value AS pinned_version_id
489
+ FROM jobs
490
+ JOIN connection
491
+ ON jobs.scope = connection.id::text
492
+ AND connection.status != 'deprecated'
493
+ JOIN actor
494
+ ON connection.source_id = actor.id
495
+ AND actor.actor_definition_id = :connector_definition_id
496
+ AND actor.tombstone = false
497
+ JOIN workspace
498
+ ON actor.workspace_id = workspace.id
499
+ AND workspace.tombstone = false
500
+ LEFT JOIN dataplane_group
501
+ ON workspace.dataplane_group_id = dataplane_group.id
502
+ LEFT JOIN scoped_configuration
503
+ ON scoped_configuration.scope_id = actor.id
504
+ AND scoped_configuration.key = 'connector_version'
505
+ AND scoped_configuration.scope_type = 'actor'
506
+ WHERE
507
+ jobs.config_type = 'sync'
508
+ AND jobs.status = 'failed'
509
+ AND jobs.updated_at >= :cutoff_date
510
+ ORDER BY
511
+ jobs.updated_at DESC
512
+ LIMIT :limit
513
+ """
514
+ )
515
+
516
+ # Get recent sync results for ALL actors using a DESTINATION connector definition.
517
+ SELECT_RECENT_SYNCS_FOR_DESTINATION_CONNECTOR = sqlalchemy.text(
518
+ """
519
+ SELECT
520
+ jobs.id AS job_id,
521
+ jobs.scope AS connection_id,
522
+ jobs.status AS job_status,
523
+ jobs.started_at AS job_started_at,
524
+ jobs.updated_at AS job_updated_at,
525
+ connection.name AS connection_name,
526
+ actor.id AS actor_id,
527
+ actor.name AS actor_name,
528
+ actor.actor_definition_id,
529
+ actor.tombstone AS actor_tombstone,
530
+ workspace.id AS workspace_id,
531
+ workspace.name AS workspace_name,
532
+ workspace.organization_id,
533
+ workspace.dataplane_group_id,
534
+ dataplane_group.name AS dataplane_name,
535
+ scoped_configuration.origin_type AS pin_origin_type,
536
+ scoped_configuration.origin AS pin_origin,
537
+ scoped_configuration.value AS pinned_version_id
538
+ FROM jobs
539
+ JOIN connection
540
+ ON jobs.scope = connection.id::text
541
+ AND connection.status != 'deprecated'
542
+ JOIN actor
543
+ ON connection.destination_id = actor.id
544
+ AND actor.actor_definition_id = :connector_definition_id
545
+ AND actor.tombstone = false
546
+ JOIN workspace
547
+ ON actor.workspace_id = workspace.id
548
+ AND workspace.tombstone = false
549
+ LEFT JOIN dataplane_group
550
+ ON workspace.dataplane_group_id = dataplane_group.id
551
+ LEFT JOIN scoped_configuration
552
+ ON scoped_configuration.scope_id = actor.id
553
+ AND scoped_configuration.key = 'connector_version'
554
+ AND scoped_configuration.scope_type = 'actor'
555
+ WHERE
556
+ jobs.config_type = 'sync'
557
+ AND jobs.updated_at >= :cutoff_date
558
+ ORDER BY
559
+ jobs.updated_at DESC
560
+ LIMIT :limit
561
+ """
562
+ )
563
+
564
+ # Same as above but filtered to only successful syncs
565
+ SELECT_RECENT_SUCCESSFUL_SYNCS_FOR_DESTINATION_CONNECTOR = sqlalchemy.text(
566
+ """
567
+ SELECT
568
+ jobs.id AS job_id,
569
+ jobs.scope AS connection_id,
570
+ jobs.status AS job_status,
571
+ jobs.started_at AS job_started_at,
572
+ jobs.updated_at AS job_updated_at,
573
+ connection.name AS connection_name,
574
+ actor.id AS actor_id,
575
+ actor.name AS actor_name,
576
+ actor.actor_definition_id,
577
+ actor.tombstone AS actor_tombstone,
578
+ workspace.id AS workspace_id,
579
+ workspace.name AS workspace_name,
580
+ workspace.organization_id,
581
+ workspace.dataplane_group_id,
582
+ dataplane_group.name AS dataplane_name,
583
+ scoped_configuration.origin_type AS pin_origin_type,
584
+ scoped_configuration.origin AS pin_origin,
585
+ scoped_configuration.value AS pinned_version_id
586
+ FROM jobs
587
+ JOIN connection
588
+ ON jobs.scope = connection.id::text
589
+ AND connection.status != 'deprecated'
590
+ JOIN actor
591
+ ON connection.destination_id = actor.id
592
+ AND actor.actor_definition_id = :connector_definition_id
593
+ AND actor.tombstone = false
594
+ JOIN workspace
595
+ ON actor.workspace_id = workspace.id
596
+ AND workspace.tombstone = false
597
+ LEFT JOIN dataplane_group
598
+ ON workspace.dataplane_group_id = dataplane_group.id
599
+ LEFT JOIN scoped_configuration
600
+ ON scoped_configuration.scope_id = actor.id
601
+ AND scoped_configuration.key = 'connector_version'
602
+ AND scoped_configuration.scope_type = 'actor'
603
+ WHERE
604
+ jobs.config_type = 'sync'
605
+ AND jobs.status = 'succeeded'
606
+ AND jobs.updated_at >= :cutoff_date
607
+ ORDER BY
608
+ jobs.updated_at DESC
609
+ LIMIT :limit
610
+ """
611
+ )
612
+
613
+ # Same as above but filtered to only failed syncs
614
+ SELECT_RECENT_FAILED_SYNCS_FOR_DESTINATION_CONNECTOR = sqlalchemy.text(
615
+ """
616
+ SELECT
617
+ jobs.id AS job_id,
618
+ jobs.scope AS connection_id,
619
+ jobs.status AS job_status,
620
+ jobs.started_at AS job_started_at,
621
+ jobs.updated_at AS job_updated_at,
622
+ connection.name AS connection_name,
623
+ actor.id AS actor_id,
624
+ actor.name AS actor_name,
625
+ actor.actor_definition_id,
626
+ actor.tombstone AS actor_tombstone,
627
+ workspace.id AS workspace_id,
628
+ workspace.name AS workspace_name,
629
+ workspace.organization_id,
630
+ workspace.dataplane_group_id,
631
+ dataplane_group.name AS dataplane_name,
632
+ scoped_configuration.origin_type AS pin_origin_type,
633
+ scoped_configuration.origin AS pin_origin,
634
+ scoped_configuration.value AS pinned_version_id
635
+ FROM jobs
636
+ JOIN connection
637
+ ON jobs.scope = connection.id::text
638
+ AND connection.status != 'deprecated'
639
+ JOIN actor
640
+ ON connection.destination_id = actor.id
641
+ AND actor.actor_definition_id = :connector_definition_id
642
+ AND actor.tombstone = false
643
+ JOIN workspace
644
+ ON actor.workspace_id = workspace.id
645
+ AND workspace.tombstone = false
646
+ LEFT JOIN dataplane_group
647
+ ON workspace.dataplane_group_id = dataplane_group.id
648
+ LEFT JOIN scoped_configuration
649
+ ON scoped_configuration.scope_id = actor.id
650
+ AND scoped_configuration.key = 'connector_version'
651
+ AND scoped_configuration.scope_type = 'actor'
652
+ WHERE
653
+ jobs.config_type = 'sync'
654
+ AND jobs.status = 'failed'
655
+ AND jobs.updated_at >= :cutoff_date
656
+ ORDER BY
657
+ jobs.updated_at DESC
658
+ LIMIT :limit
659
+ """
660
+ )
661
+
363
662
  # Get failed attempt results for ALL actors using a connector definition.
364
663
  # Finds all actors with the given actor_definition_id and returns their failed sync attempts,
365
664
  # regardless of whether they have explicit version pins.
@@ -39,7 +39,6 @@ from airbyte_ops_mcp.connection_config_retriever import (
39
39
  ConnectionObject,
40
40
  retrieve_objects,
41
41
  )
42
- from airbyte_ops_mcp.gcp_auth import ensure_adc_credentials
43
42
 
44
43
  if TYPE_CHECKING:
45
44
  from airbyte_ops_mcp.regression_tests.connection_fetcher import ConnectionData
@@ -85,9 +84,6 @@ def retrieve_unmasked_config(
85
84
  Returns:
86
85
  The unmasked source config dict, or None if retrieval fails.
87
86
  """
88
- # Ensure GCP credentials are available (supports GCP_PROD_DB_ACCESS_CREDENTIALS fallback)
89
- ensure_adc_credentials()
90
-
91
87
  # Only request the source config - that's all we need for secrets
92
88
  requested_objects = [ConnectionObject.SOURCE_CONFIG]
93
89