Open4
【TROCCO】

データ転送の一覧は取れなさそう
転送設定の設定を精査する
Git連携している前提
Git連携のymlファイルを精査
import os
import yaml
import pandas as pd
# フォルダのパス
folder_path = './trocco-master/job_definitions'
# 対象ファイルを抽出
yaml_files = [
f for f in os.listdir(folder_path)
# マネージド転送設定で設定される最初の文字列
if f.startswith('records_') and f.endswith(('.yml', '.yaml'))
]
rows = []
for filename in yaml_files:
file_path = os.path.join(folder_path, filename)
with open(file_path, 'r') as f:
data = yaml.safe_load(f)
# mysql → bigqueryの想定
row = {
'filename': filename,
'job_definition_name': data.get('name'),
'in_type': data.get('transfer_option', {}).get('in', {}).get('type'),
'mysql_connection': data.get('transfer_option', {}).get('in', {}).get('mysql_connection', {}).get('name'),
'database': data.get('transfer_option', {}).get('in', {}).get('database'),
'query': data.get('transfer_option', {}).get('in', {}).get('query'),
'out_type': data.get('transfer_option', {}).get('out', {}).get('type'),
'bigquery_connection': data.get('transfer_option', {}).get('out', {}).get('bigquery_connection', {}).get('name'),
'database': data.get('transfer_option', {}).get('out', {}).get('database'),
'table': data.get('transfer_option', {}).get('out', {}).get('table'),
'mode': data.get('transfer_option', {}).get('out', {}).get('mode'),
'partitioning_type': data.get('transfer_option', {}).get('out', {}).get('partitioning_type'),
'time_partitioning_type': data.get('transfer_option', {}).get('out', {}).get('time_partitioning', {}).get('type'),
'time_partitioning_field': data.get('transfer_option', {}).get('out', {}).get('time_partitioning', {}).get('field'),
}
rows.append(row)
df = pd.DataFrame(rows)
print(df.head())
df.to_csv('output.csv', index=False)

TROCCOのGitリポジトリ連携機能は、シンプルに連携したファイルの変更管理をする機能ですので、同リポジトリのmasterに他ファイルを含めることでなにか影響がでる、といったことはございません。
「Gitリポジトリ連携」用のリポジトリに、github actionsを仕込む

name: Deploy TROCCO Job
on:
push:
branches:
- master
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
cache: 'pip'
- name: Install dependencies
run: pip install -r requirements.txt
- name: Deploy TROCCO Job
run: python scripts/deploy_trocco.py

設定をCI
- パーティション設定
- partition_field や partition_expiration_daysが設定されているか
- partition_fieldがカラムのcreated_atとupdated_atとかどれを採用しているか
- partition_expiration_daysがDAY設定か
- 設定名が命名規則どうりになっているかどうか
- マネージド転送設定で一括で、リプレイスやマージの設定ができているか
- 未実行の古すぎる設定があるかどうか
など