简体   繁体   English

源选项中的 Azure 数据工厂递归查询

[英]Azure Data Factory Recursive Query in source option

I'm trying to execute a recursive query in Azure Data Factory Source using the query option.我正在尝试使用查询选项在 Azure 数据工厂源中执行递归查询。

在此处输入图片说明

However, even writting go or ;但是,即使写go; before the with sentence, Data Factory is not able to project the columns.with语句之前,数据工厂无法投影列。 If I write (before the with clause):如果我写(在 with 子句之前):

  • "Go", I've got this error "shaded.msdataflow.com.microsoft.sqlserver.jdbc.SQLServerException: Incorrect syntax near 'r'. If this is intended to be a common table expression, you need to explicitly terminate the previous statement with a semi-colon." “Go”,我收到了这个错误"shaded.msdataflow.com.microsoft.sqlserver.jdbc.SQLServerException: Incorrect syntax near 'r'. If this is intended to be a common table expression, you need to explicitly terminate the previous statement with a semi-colon."
  • If I write ";", I've got this one shaded.msdataflow.com.microsoft.sqlserver.jdbc.SQLServerException: Incorrect syntax near ';'.如果我写“;”,我就会得到这个shaded.msdataflow.com.microsoft.sqlserver.jdbc.SQLServerException: Incorrect syntax near ';'.
  • If I do not write anything s haded.msdataflow.com.microsoft.sqlserver.jdbc.SQLServerException: Incorrect syntax near the keyword 'with'.如果我没有写任何东西 s haded.msdataflow.com.microsoft.sqlserver.jdbc.SQLServerException: Incorrect syntax near the keyword 'with'.

So I wonder if this kind of code is not allowed in Azure Data Factory, or if there is something I'm missing.所以我想知道 Azure 数据工厂中是否不允许使用这种代码,或者我是否遗漏了什么。

The query that you can enter into the Data Flow's Source Options is extremely limited as it doesn't even support order by clauses.您可以输入到数据流的源选项中的查询非常有限,因为它甚至不支持order by子句。 You can reference a user-defined function, however, so you could nest your CTE inside a UDF and then reference that from Source Options.但是,您可以引用用户定义的函数,因此您可以将 CTE 嵌套在 UDF 中,然后从源选项中引用它。

REF: Source transformation REF: 源转换

Query: If you select Query in the input field, enter a SQL query for your source.查询:如果您在输入字段中选择查询,请为您的源输入 SQL 查询。 This setting overrides any table that you've chosen in the dataset.此设置会覆盖您在数据集中选择的任何表。 Order By clauses aren't supported here, but you can set a full SELECT FROM statement.此处不支持 Order By 子句,但您可以设置完整的 SELECT FROM 语句。 You can also use user-defined table functions.您还可以使用用户定义的表函数。 select * from udfGetData() is a UDF in SQL that returns a table. select * from udfGetData() 是 SQL 中返回表的 UDF。 This query will produce a source table that you can use in your data flow.此查询将生成可在数据流中使用的源表。 Using queries is also a great way to reduce rows for testing or for lookups.使用查询也是减少用于测试或查找的行的好方法。

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

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