在 Pentaho 中将 SQL 查询作为参数传递?

Passing SQL query as a Parameter in Pentaho?

有一个 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 中的 table t_slalom_outputs 获取数据,另一个从 Postgres Table msp_startingpoints 获取数据。 修改后的 date >(Postgres 查询)

有什么方法可以将 Postgres 查询作为参数值传递给整个查询?

使用输入 table 从 Postges 数据库中获取 msp_startingpoints。然后将结果放入 Input table 中,但 t.modify_date > (SELECT ...) 已被 t.modify_date > ? 替换,将 Insert data from step 指定为第一步。

就是这样。

神奇之处在于问号被传入步骤中的值所取代。在您的情况下,您只有一列和一行,但您可能有更多列(注意列的顺序)并且不止一行(注意结果中行的顺序)。