根据文本文件输入元数据进行数据库插入 [英] Make a DB INSERT based on Text File Input metadata

查看:116
本文介绍了根据文本文件输入元数据进行数据库插入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发ETL,并且必须执行一些例程来对其进行监视.

I'm developing an ETL and must do some routines for monitoring it.

首先,我必须在DB上的INSERT中创建一条记录,以通知文件名和开始进程的日期时间.该查询将返回记录的PK,并且必须将其存储.该文件的ETL完成后,我必须更新该记录,以告知ETL成功完成及其结束过程的日期时间.

At the begining, I must make in INSERT on DB to create a record informing the filename and starting process datetime. This query will return the record's PK and it must be stored. When the ETL of that file finishes, I must update that record informing the ETL finished with success and its ending process datetime.

我使用文本文件输入来查找与其正则表达式匹配的文件,并将其其他输出字段"添加到流中.但是我找不到一个仅可用于第一条记录并会执行INSERT的SQL命令的组件.

I use Text File Input to look for files that match its regex, and add its "Additional output fields" to stream. But I can't find a component that will run only for first record and will execute a SQL command for the INSERT.

推荐答案

您可以将标识最后一行"和过滤行"一起使用,因此输入中仅保留一行(仅过滤最后一行). INSERT将紧接在筛选器行"步骤之后.

You can use "Identify last row" and "Filter rows" together, so you will keep only one line from your input (filtering just the last one). You INSERT will be right after the Filter Rows step.

由于需要拆分流程,因此需要将ID列与原始文本输入行连接起来.

As you will need to split your flow, you'll need to join your ID column with the original text input rows.

这篇关于根据文本文件输入元数据进行数据库插入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆