内容纲要
概要描述
背景:本文是为了统计在tds的tdt模块中,根据源端数据源和目标端数据源筛选,共计加载表有多少张。结尾附上sql。
详细说明
所有用到的库表说明
1.tdt_transporter1.tdt_solution_model_config
这张表记录了tdt任务所有的配置项及参数,这边我们需要用到tableDetails这个name
2.tdt_transporter1.tdt_solution
这张表记录了创建加载任务的基本情况,包括创建该任务的owner、time,以及该tdt任务的唯一id、类型等等。这个地方我们需要根据唯一id去和上一张表的solution_uuid进行匹配
3.tdt_transporter1.tdt_runtime_env_config
这张表记录了tdt任务运行时拆解下的子任务对应的值,包括固定值和涉及到的数据源id
4.connector_foundation1.datasource
这张表记录了所有的数据源信息,此张表是为了和tdt_runtime_env_config表关联得出想要的源端数据源名称和目标端数据源名称
5.connector_foundation1.connection
这张表记录了所有的连接信息,此张表是为了和tdt_runtime_env_config表关联得出对应的数据源连接信息
具体sql参考
select count(solution_uuid)
from tdt_transporter1.tdt_solution_model_config
where name='tableDetails'
and solution_uuid in
(
select solution_uuid from
(select s.unique_id as solution_uuid ,s.name as tdt_name, n.name as connection_name, d.name as datasource_name,e.name as src_datasource_name from tdt_transporter1.tdt_solution s
inner join (select * from tdt_runtime_env_config where name= 'engineUuid') c on c.solution_uuid = s.unique_id
inner join (select * from tdt_runtime_env_config where name= 'jdbcConnUuid') f on f.solution_uuid = s.unique_id
inner join connector_foundation1.datasource d on d.uuid = replace(c.value, '"', '')
inner join connector_foundation1.connection n on n.uuid = d.connection_uuid
inner join connector_foundation1.datasource e on e.uuid = replace(f.value, '"', '')
order by n.name, d.name asc) v
where v.datasource_name = 'kundb_sjn' and v.src_datasource_name= '172.22.23.2-523');