kaarel
kaarel

Reputation: 51

Data factory Use query to create json

I have this situation where I need to create a json based on metadata and I have run into a problem with creation.

I use a database for making the query and it looks like this: Use query:

SELECT CONCAT(
'
{
"entries": [
{
"example": true,
"url": "https://xxxxxx.core.windows.net/xxxxx/',
'@{pipeline().Pipeline}',
'/',
 '@{
 concat(
item().name
)
}',
'"
}]}'
)AS json

The result will look like this:

{"json":"\n{\n\"entries\": [\n{\n\"example\": true,\n\"url\": \"https://xxxxx.core.windows.net/xxxxx/yyyyyyy/table.aaaa.20200914003004.ooo.20200914003004.false.json\"\n}]}"}

How to a get rid of the line feed \n ?

Also tried this:

SELECT CONCAT('{"entries":[{"example":true,"url":"https://xxxxxx.core.windows.net/yyyyyyyy/','@{Pipeline().Pipeline}','/','@{concat(item().name)}','"}]}' ) AS json

The end result should look like this

>    {
>       "entries": [
>         {
>           "example": true,
>           "url": "https://xxx.blob.core.windows.net/yyy/asasadasdek/asdaedasd"
>         }
>       ]
>     }

Update

Tasks: Get file names from blob, the names and copy names to one json file

Get file names from blob, the names and copy names to one json file

Copy source activity should create a format like this

    SELECT CONCAT(
'
{
"entries": [
{
"example": true,
"url": "https://xxxxxx.core.windows.net/xxxxx/',
'@{pipeline().Pipeline}',
'/',
 '@{
 concat(
item().name
)
}',
'"
}]}'
)AS json

But it still has the problem with \n

Upvotes: 1

Views: 604

Answers (1)

Joseph  Xu
Joseph Xu

Reputation: 6083

Update:
So we can change the query to SELECT CONCAT(' '@{CONCAT(activity('variable1'))}' ') AS JSON. Then we can remove the \n character.

Upvotes: 1

Related Questions