1

I want to copy items from

CosmosDB databaseA/productCollection

to

CosmosDB databaseB/productCollection

Therefore I decided to use Azure Data Factory. I actived also "Export as-is to JSON files or Cosmos DB collection".

The read operation works as expected.
Unfortunately, the write operation stops because of an error related to the data:

ErrorCode=InvalidTemplate, ErrorMessage=Unable to parse expression 'Currency'

{
"ProductName": "Sample",
"Price": {
    "@Currency": "GBP",
    "$": "2624.83"
}

}

I'm not able to change to input data itself. The output data has to equal the input data.

Is there possiblity, that @Currency will not be interpreted as an expression

In ARM, this part is failling:

Price.{@Currency}

0

2 Answers 2

1

I had the same problem and I was able to resolve accordingly.

I am using a Pipeline with a Source that is a Dataset referencing JSON data.

Clicking the button highlighted below.

Dataset Editor

I had to change the JSON from

{
  "name": "SourceDataset",
  "properties": {
    "linkedServiceName": {
      "referenceName": "StorageAccountLink",
      "type": "LinkedServiceReference"
    },
    "annotations": [],
    "type": "Json",
    "typeProperties": {
      "location": {
        "type": "AzureBlobStorageLocation",
        "container": "test-data"
      }
    },
    "schema": {
      "type": "object",
      "properties": {
        "@context": {
          "type": "string"
        },
        "value": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              }
            }
          }
        }
      }
    }
  }
}

To ( Escaping the @ with @@ )

{
  "name": "SourceDataset",
  "properties": {
    "linkedServiceName": {
      "referenceName": "StorageAccountLink",
      "type": "LinkedServiceReference"
    },
    "annotations": [],
    "type": "Json",
    "typeProperties": {
      "location": {
        "type": "AzureBlobStorageLocation",
        "container": "test-data"
      }
    },
    "schema": {
      "type": "object",
      "properties": {
        "@@context": {
          "type": "string"
        },
        "value": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              }
            }
          }
        }
      }
    }
  }
}
Sign up to request clarification or add additional context in comments.

Comments

0

I tried to reproduce your issue but it works for me. I used copy activity to transfer data from account A to account B.

enter image description here

enter image description here

Additional, if this operation is just need to be executed once, please consider using Azure Cosmos DB Migration Tool. It's free for usage. You could export the data from cosmos db A as json file then import it into cosmos db B very simply.Also, it could be executed in the cmd so that it could be made as a scheduled job on the windows system.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.