简体   繁体   English

有没有办法从 Azure 数据工厂内部编写 SQL 查询?

[英]Is there a way to author a SQL query from inside Azure Data Factory?

试图找到一种从 ADF 内部编写 SQL 查询的方法,这是可能的,还是需要创建一个视图来做类似的事情?

是的,我们可以根据您要实现的目标,复制活动,查找活动是几个例子

Most of time, yes you can author SQL queries from inside of ADF.大多数情况下,是的,您可以从 ADF 内部编写 SQL 查询。

For SQL server and Azure SQL database, copy data from or to SQL server or Azure SQL database support you use the SQL query to select the data.对于 SQL Server 和 Azure SQL 数据库,从或向 SQL Server 或 Azure SQL 数据库复制数据支持您使用 SQL 查询来选择数据。

For example, using 'Copy Data' to copy data between Azure SQL:例如,使用“复制数据”在 Azure SQL 之间复制数据: 在此处输入图片说明

But these SQL queries are used for Source dataset settings .但是这些 SQL 查询用于源数据集设置

There are a lot examples can help you understand Azure Data Factory Copy Actives.有很多示例可以帮助您了解 Azure 数据工厂复制活动。

Such as: Copy Data From On-Premise SQL Server To Azure Database Using Azure Data Factory .例如: 使用 Azure 数据工厂将数据从本地 SQL Server 复制到 Azure 数据库

I suggest you read more about Azure Data Factory Document .我建议您阅读有关Azure 数据工厂文档的更多信息。 You will have the answer more clearly.你会有更清楚的答案。

Hope this helps.希望这可以帮助。

It depends on what you mean with "author SQL queries".这取决于您对“作者 SQL 查询”的含义。

If you want to write sql queries based on input from other activities and execute them you can do this by using dynamic content (click on "add dynamic content" on the query field where you want to execute the sql query, eg in copy data or lookup)如果您想根据来自其他活动的输入编写 sql 查询并执行它们,您可以使用动态内容来完成此操作(在要执行 sql 查询的查询字段上单击“添加动态内容”,例如在复制数据或抬头)

If you want to run sql code on a data source from a data factory eg to create a table there you can use the lookup activity and just add a ;select 1;如果您想在数据工厂的数据源上运行 sql 代码,例如在那里创建一个表,您可以使用查找活动并添加一个 ;select 1; in the end.到底。 eg例如

Select * into newtable from oldtable; select 1;

Also you could use a stored procedure on a data source eg azure sql or sql server and provide properties from data factory.您也可以在数据源上使用存储过程,例如 azure sql 或 sql server,并提供数据工厂的属性。

For all this best to create a dataset where you leave the "table" property empty and use this.对于所有这些,最好创建一个数据集,将“table”属性留空并使用它。

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

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