简体   繁体   English

有人可以解释通过SSIS和VS构建ETL时使用的“ BypassPrepare”连接参数吗?

[英]Can someone explain the `BypassPrepare` connection-parameter used when building an ETL via SSIS and VS?

From The MSDN Forums: MSDN论坛:

If you set this option to true then the preparing (ie parsing) is done by the database engine you are connecting to. 如果将此选项设置为true,则准备工作(即解析)由要连接的数据库引擎完成。 If you set this option to false then the preparation is done by integration services package. 如果将此选项设置为false,则准备工作由Integration Services包完成。
This option is available only for OLEDB type connections and was introduced because pacakge (sql task) cannot prepare/parse all the SQL commands that OLEDB database supports. 由于pacakge(SQL任务)无法准备/解析OLEDB数据库支持的所有SQL命令,因此引入了此选项,仅适用于OLEDB类型的连接 Meaning that you would get error in parse phase and would not be able to execute the statement that is valid statement on OLEDB database but cannot be prepared/parsed by SQL task. 这意味着您将在解析阶段出错,并且将无法执行在OLEDB数据库上有效的语句,但无法由SQL任务准备/解析的语句。
~Dean Savović 〜迪安·萨沃维奇

I'm just going to be honest and say that I don't understand this answer. 我只是说老实话,说我不明白这个答案。 I am a networking person, and am only (slowly) learning data-warehousing. 我是网络专家,并且(缓慢地)仅学习数据仓库。


My question is 2-part: 我的问题分为两部分:
1. When Dean says "prepare/parse," what parsing/preparing is going on? 1.当Dean说“准备/解析”时,正在进行什么解析/准备?

2. OLEDB is an API as far as I understand. 2.据我了解,OLEDB是一个API。 Are requests to an OLEDB interface serialized? 对OLEDB接口的请求是否已序列化? If not, what would prevent Visual Studio + SSIS from sending strings containing supported commands? 如果不是,什么会阻止Visual Studio + SSIS发送包含受支持命令的字符串?


I feel like I'm missing something crucial about OLEDB connections here. 我觉得这里缺少有关OLEDB连接的关键信息。 I've found 2 other SO questions on this topic, but both have received answers parroting the quote above. 我还发现了关于该主题的其他2个SO问题,但两个问题都使上面的引文引起了争议。

First of all, it is important to remember that BypassPrepare is a property of Execute SQL Task, not a database connection. 首先,请务必记住BypassPrepare是Execute SQL Task的属性,而不是数据库连接。

The property allows you to toggle design-time SQL syntax check, which can be done for you by VS automatically when you are authoring a package. 该属性使您可以切换设计时SQL语法检查,创作包时,VS可以自动为您完成此检查。 If you turn the check on and try to set a syntactically incorrect SQL statement, the component editor will tell you everything it thinks about you in general, and your SQL coding skills in particular. 如果打开检查并尝试设置语法上不正确的SQL语句,则组件编辑器会告诉您它通常对您的所有想法,尤其是您的SQL编码技能。

With the syntax check disabled, you can feed absolutely any kind of hogwash to the task, and nothing will happen until you will try to actually execute it. 在禁用语法检查的情况下,您可以向任务绝对喂食任何东西,在尝试实际执行之前不会发生任何事情。 In that case, you will have a run-time exception. 在这种情况下,您将遇到运行时异常。

If you, like me and many other developers, first concoct your SQL statements in a full-fledged SQL editor like SSMS or similar, you probably don't need to touch the option at all, and leave this syntax check disabled by default. 如果像我和许多其他开发人员一样,首先在功能强大的SQL编辑器(例如SSMS或类似工具)中编写SQL语句,则可能根本不需要触摸该选项,并且默认情况下禁用此语法检查。

Another issue with this property is that it raises false alarms every time you are trying to save parameterised SQL. 此属性的另一个问题是,每次尝试保存参数化SQL时,它都会引发错误警报。 I'm not sure if it works correctly with ADO.Net, but in case of OLEDB connection parameters are designated by question marks, and the built-in syntax checker appears to be blissfully unaware of this part of component's functionality. 我不确定它是否可以与ADO.Net一起正常使用,但是如果OLEDB连接参数由问号指定,则内置语法检查器似乎很高兴不知道组件功能的这一部分。

If you were thinking whether SSIS switches to prepared statements with this property set to False, AFAIK it doesn't do that. 如果您在考虑SSIS是否将此属性设置为False的预备语句切换到AFAIK,则不会这样做。 In ETL, a typical query usually runs once and grabs either most or all of table's rows. 在ETL中,典型查询通常运行一次,并获取表的大部分或全部行。 There is no gain to be obtained by preparing such a statement before execution. 在执行之前准备这样的语句不会获得任何收益。 Having said that, I might actually be wrong; 话虽如此,我可能实际上是错的。 one only needs to set up a Profiler / XEvents trace to verify this. 只需设置一个Profiler / XEvents跟踪即可验证这一点。

My advice: leave it at its default value. 我的建议:将其保留为默认值。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM