有一个Pentaho步骤,我被卡住了。这是我的Pentaho步骤中的SQL查询:
select t.val_1 as Contract,
t.val_2 as Service,
t.val_3 as Calender,
t.val_4 as MSPProvider,
t.val_5 as MSPCustomer,
t.val_6 as ObjectName,
t.val_7 as EventID,
to_timestamp(t.val_8,'MM-DD-YYYY HH:MI:SS PM') as Startdate,
to_timestamp(t.val_9,'MM-DD-YYYY HH:MI:SS PM') as Startkeydate,
to_timestamp(t.val_10,'MM-DD-YYYY HH:MI:SS PM') as Enddate,
to_timestamp(t.val_11,'MM-DD-YYYY HH:MI:SS PM') as Endkeydate,
t.val_12 as Duration,
t.val_13 as DurationMod,
t.val_14 as Suspend,
t.val_15 as SuspendExternal,
t.val_16 as Excluded,
t.val_17 as Target,
t.val_18 as TargetUnit,
t.val_19 as Relation,
t.val_20 as Violated,
t.val_21 as CalculationType,
t.val_22 as calculationversion,
t.val_23 as Category,
'sec' as ValueUnit,
t.val_24 as TicketUnit,
t.val_25 as Severity,
t.val_26 as Impact,
t.val_27 as ExclusionID,
t.val_28 as OriginatorID,
t.val_25 as SeverityID,
t.val_29 as ReOpened,
t.create_date as CreateDate,
t.modify_date as ModifyDate
from t_slalom_outputs t
where t.is_active = 1
and t.table_name = 'TICKET'
and t.val_4 = '${MSP_PROVIDER}'
and t.modify_date > (SELECT sp_timestamp FROM public.msp_startingpoints where sp_name = 'etl_export_result_slalom')
modify_date >
之后的查询是从Postgres数据库中选择数据,其余查询是从Oracle服务器获取数据。
我应该如何区分这两个?
一个是从Oracle中的表t_slalom_outputs
和Postgres表msp_startingpoints
中的其他表中获取数据。
修改后的date >
(Postgres查询)
有什么方法可以将Postgres查询作为参数值传递给整个查询?
答案 0 :(得分:1)
使用输入表从Postges数据库中获取msp_startingpoints
。然后将结果放在Input table
的查询中,除了t.modify_date > (SELECT ...)
已被t.modify_date > ?
替换,指定Insert data from step
为第一步。
那就是它。
魔术来自于问号被来自传入步骤的值替换的事实。在您的情况下,您有一列和一行,但您可能有更多列(请注意列的顺序)和多行(请注意结果中行的顺序)。