如何使 Azure 数据工厂在将表发送到 Sink 之前删除字段,而不使用 DataFlows

huangapple go评论52阅读模式
英文:

How to Get Azure Data Factory to delete a field before send a table to Sink Without using DataFlows

问题

可以在将表发送到Sink位置之前,让ADF删除表中的字段吗?例如,如果我有一个Lookup活动,发现表中的一个字段,那么在将表发送到Sink之前,能否让复制活动删除该字段?

英文:

Is it possible to get ADF to delete a field in a table before it is sent to Sink location?

For example if I have a Lookup activity that discovers a field in a table is it possible to for the copy activity to delete that field in the table before sending the table to sink?

答案1

得分: 1

你可以将以下 SQL 脚本添加到复制活动的预复制脚本中的接收器设置中:

IF EXISTS (SELECT 1
           FROM   INFORMATION_SCHEMA.COLUMNS
           WHERE  TABLE_NAME = 'Table1'
                  AND COLUMN_NAME = 'col1'
                  AND TABLE_SCHEMA='Schema1') 
BEGIN
  ALTER TABLE Table1
    DROP COLUMN col1
 END
英文:

You can add the below sql script in the pre-copy script in the sink settings of copy activity:

IF EXISTS (SELECT 1
           FROM   INFORMATION_SCHEMA.COLUMNS
           WHERE  TABLE_NAME = 'Table1'
                  AND COLUMN_NAME = 'col1'
                  AND TABLE_SCHEMA='Schema1') 
BEGIN
  ALTER TABLE Table1
    DROP COLUMN col1
 END

huangapple
  • 本文由 发表于 2023年6月21日 23:46:11
  • 转载请务必保留本文链接:https://go.coder-hub.com/76525057.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定