如何通过Blob中的CSV文件在SQL数据库中创建一个表,该表包含所有列名称及其通过数据流或ADF管道的数据类型? [英] How to create a table in SQL Database from a CSV file in Blob which contain all the column name with its data type through Data Flow or ADF pipeline?

查看:136
本文介绍了如何通过Blob中的CSV文件在SQL数据库中创建一个表,该表包含所有列名称及其通过数据流或ADF管道的数据类型?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的Azure Blob存储中有一个CSV文件,其中包含所有列名及其相应表的数据数据类型.

I am having a CSV file in my Azure Blob Storage which contain all the column name with its data Data type of respective tables.

我想从此Blob文件中使用相同的列名及其相应的数据类型在SQL数据库中创建一个表,而无需执行映射.

I want to create a table in SQL Database from this Blob file with the same column name with its corresponding datatype without doing the mapping.

我已经通过数据流创建了一个表,但是我必须手动设置每列的数据类型.但是我不想这样做. 创建表时,它应该在源中接受相同的数据类型,并在CSV文件中接受同步.

I have created a table through data flow but I have to set the data type of each column manually. But I don't want to do this. When I create a table it should accept the same data types in the source as well as synch which was given in the CSV file.

[]

[]

当我导入架构时,它将整列作为ID (int),并将数据类型作为String,但是我想要在导入架构并创建表时将其列名称作为ID,并将数据类型作为,并且它将对多个表使用相同的所有列名.

When I import the schema it takes full column as ID (int) and data type as String but I want when I import the schema and create a table it will take column name as ID and data type as INT and it will do same all column names for multiple tables.

如果您有解决此问题的方法,请告诉我.

Please let me know if you have a solution to this problem.

推荐答案

在Data Factory中,当我们从

In Data Factory, when we copy data from the CSV file, we set first row as column, that means that the first row data will be set as column name, id(int) and Name(varchar). As you know, the default column name data type is String(in Data Factory)/varchar(128)(in SQL database), we can not change it.

我们无法使用模式作为列名来创建表!没有解决这个问题的方法.

We can not create the table with schema as column name! There's no solution to this problem.

但是Data Factory会自动帮助我们为我们创建合适的列数据类型映射.

But Data Factory will auto help us create the suitable column data type mapping for us.

例如,如果您的csv文件是这样的:

For example, if your csv file is like this:

自动架构映射会将Azure SQL数据库中的"1"(字符串)转换为1(int).

Auto schema mapping will convert "1"(string) to 1(int) in Azure SQL database.

希望这会有所帮助.

这篇关于如何通过Blob中的CSV文件在SQL数据库中创建一个表,该表包含所有列名称及其通过数据流或ADF管道的数据类型?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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