tsql 从无服务器 SQL 池中的 JSON 数据创建提取键和值

问题描述 投票:0回答:0

How to create external table using Serverless SQL pool using tsql in Azure Synapse Analytics for this scenario:

我在名为“companyDetail”的表中有一个“employeeInfo”列。 这是创建“companyDetail”表的查询:

CREATE EXTERNAL TABLE companyDetail
(
  companyName varchar(100),
  employeeInfo varchar(2048) 
) 
WITH
(
    LOCATION = '/all_parquet_files/*.parquet',
    DATA_SOURCE = parquet_datasource,
    FILE_FORMAT = parquet
)
 

company明细表数据:

companyName| employeeInfo
----------------------------
ABC        | {name: Ramesh, age:32 years}
ABC        | {name: Mohan, experience:2 years}
DEF        | {name: Dinesh, age:39, experience:5 years}
HIJ        |
DEF        | {name: Mohit}

我必须从该数据创建一个外部表“employee”,它应该有这个结果:

companyName| employeeKey | employeeValue
------------------------------------------
ABC        | name        | Ramesh
ABC        | age         | 32 years
ABC        | name        | Mohan
ABC        | experience  | 2 years
ABC        | name        | Dinesh
ABC        | age         | 39
ABC        | experience  | 2 years
HIJ        |             |
DEF        | name        | Mohit

json tsql azure-data-factory serverless azure-synapse
© www.soinside.com 2019 - 2024. All rights reserved.