使用 pentaho 勺子每天更新数据库中的数据
Posted
技术标签:
【中文标题】使用 pentaho 勺子每天更新数据库中的数据【英文标题】:updating day by day data in database using pentaho spoon 【发布时间】:2015-03-29 07:18:53 【问题描述】:我有一个如下所述的 SQL 查询,它将每天更新 DB 比较日期(最新的附加日期数据将在 DB 中更新),我想在使用 Pentaho 数据集成 (Kettle) 的转换中执行此操作。
Do While i < dgTest.RowCount
dd = Mid(dgTest.Item(2, i).Value, 5, 2) & "/" & Mid(dgTest.Item(2, i).Value, 7, 2) & "/" & Mid(dgTest.Item(2, i).Value, 1, 4)
Sql = "INSERT INTO cash ([comp], strno, bday, openread, curread,refqty,refamt, promoq," & _
" promoa, netsprod, netsnprod, eatintc, eatins, eatouttc, eatouts, " & _
" dttc, coffeetc, dts, coffeesales, csh, cover,recamt,crsalesamt ) Values " & _
" ('" & dgTest.Item(0, i).Value.ToString & "','" & dgTest.Item(1, i).Value.ToString & _
"',#" & CDate(dd) & "#,'" & dgTest.Item(3, i).Value.ToString & "'," & dgTest.Item(4, i).Value & "," & _
dgTest.Item(5, i).Value & "," & dgTest.Item(6, i).Value & _
"," & dgTest.Item(7, i).Value & _
"," & dgTest.Item(8, i).Value & "," & dgTest.Item(9, i).Value & _
"," & dgTest.Item(10, i).Value & "," & dgTest.Item(11, i).Value & _
"," & dgTest.Item(12, i).Value & "," & dgTest.Item(13, i).Value & "," & dgTest.Item(14, i).Value & _
"," & dgTest.Item(15, i).Value & "," & dgTest.Item(16, i).Value & "," & dgTest.Item(17, i).Value & "," & dgTest.Item(18, i).Value & "," & dgTest.Item(19, i).Value & "," & dgTest.Item(20, i).Value & "," & dgTest.Item(21, i).Value & "," & dgTest.Item(22, i).Value & ")"
cmd = New OleDbCommand(Sql, con)
cmd.ExecuteNonQuery()
i = i + 1
Loop
【问题讨论】:
【参考方案1】:我不明白您尝试实施的方法,但您可以做的是从输入表步骤读取数据,使用修改后的 java 脚本并指定在这个特定时间更新数据库.. 示例
var d = new Date();
var hour1 = d.getHours();
if(hour1==14)
if(d.getDate()==day2 && month1==month2 && year1==year2 && hour>=13 && hour<17)
【讨论】:
以上是关于使用 pentaho 勺子每天更新数据库中的数据的主要内容,如果未能解决你的问题,请参考以下文章