在日期列上拆分 Mysql table 并将结果存储在具有动态名称的不同 table 中
Split Mysql table on date column and store result in different tables with dynamic name
我的工作看起来像我尝试阅读 Mysql table 的第一张图片,
并根据 FROM_DATE 字段拆分 table 。作业中的步骤如下:
使用tMap创建一列StringFromDate -> TalendDate.formatDate("yyyy-MM-dd",row1.FROM_DATE)
将 tMapOutput 连接到 tFlowToIterate
将 tFlowToIterate 连接到 tFixedFlowInput。 tFixedFlowInput 组件配置如下图二
将 tFixedFlowInput 连接到 tLogRow
将 tLogRow 连接到 tMysqlOutput。 tMysql输出组件设置如第三图
问题是 table 只生成了 1 行数据。当我尝试在 csv 文件中收集数据时,此设置与 tFileOutputDelimited 中的附加选项配合使用时效果很好。
拜托,需要立即帮助。
问题是由 tMysqlOutput
设置 drop table if exists and create
引起的,它会在每次迭代时有效地重新创建您的 table。因此,您最终在 table 中得到的一行是对应于最后一次迭代的那一行。
尝试设置 create table if not exists
.
此外,根据您的后续问题,您需要在 tMysqlOutput
之后添加 OnComponentOk -- tMysqlCommit
(取消选中关闭连接)才能提交插入内容。
我的工作看起来像我尝试阅读 Mysql table 的第一张图片, 并根据 FROM_DATE 字段拆分 table 。作业中的步骤如下:
使用tMap创建一列StringFromDate -> TalendDate.formatDate("yyyy-MM-dd",row1.FROM_DATE)
将 tMapOutput 连接到 tFlowToIterate
将 tFlowToIterate 连接到 tFixedFlowInput。 tFixedFlowInput 组件配置如下图二
将 tFixedFlowInput 连接到 tLogRow
将 tLogRow 连接到 tMysqlOutput。 tMysql输出组件设置如第三图
问题是 table 只生成了 1 行数据。当我尝试在 csv 文件中收集数据时,此设置与 tFileOutputDelimited 中的附加选项配合使用时效果很好。
拜托,需要立即帮助。
问题是由 tMysqlOutput
设置 drop table if exists and create
引起的,它会在每次迭代时有效地重新创建您的 table。因此,您最终在 table 中得到的一行是对应于最后一次迭代的那一行。
尝试设置 create table if not exists
.
此外,根据您的后续问题,您需要在 tMysqlOutput
之后添加 OnComponentOk -- tMysqlCommit
(取消选中关闭连接)才能提交插入内容。