SQL Server Can we create an Azure SQL database table dynamically, named after a file in blob storage using ADF?

y4ekin9u  于 2024-01-05  发布在  其他
关注(0)|答案(1)|浏览(119)

I am trying to create a table in my Azure SQL Database, based off files uploaded in a blob storage directory (in JSON format). The schema needs to be the dynamic and be based off the file at the directory at the time e.g. schema could be varchar(3),int,float in one instance, in another it could be varchar(4),int,int,int.

Is there any solution to this using ADF? (and or stored procedures?). I've looked everywhere, and no one seems to have solved this exact problem.

I've tried using Get Meta Data activity and passing that into a stored procedure, but that doesn't solve the problem of the dynamic schema.

hk8txs48

hk8txs481#

If we use auto create table option inside copy activity - sink tab, then it will automatically creates table Azure SQL.
But in your case, it seems schema you want to have control. For that, try to have schema stored at some file and then read in ADF using lookup activity . And inside Sink tab of copy activity, in pre-copy script option, use that schema before load of file. This creates table first and then loads data in to it.

相关问题