AzureCosmosDB / data-migration-desktop-tool

MIT License
106 stars 39 forks source link

Adding paremeter to cosmosdb query SourceSettings #96

Open olivierbachard opened 7 months ago

olivierbachard commented 7 months ago

Hello, I would need to export data from cosmosdb using a query where I can pass some parameter at execution, but I did not manage to find a way to do it. Here is a sample of my migrationsettings.json :

{
  "Source": "cosmos-nosql",
  "Sink": "cosmos-nosql",
  "SourceSettings": {
      "ConnectionString": "<source_ConnectionString>",
      "Database": "<source_Database>"
  },
  "SinkSettings": {
      "ConnectionString": "<dest_ConnectionString>",
      "Database": "<dest_Database>"
  },
  "Operations": [
    {
      "SourceSettings": {
          "Query": "SELECT * FROM c WHERE c.someProperty= '<my_dynamic_parameter>'",
          "Container": "<soure_container>"
      },
      "SinkSettings": {
          "Container": "<dest_container>",
      "PartitionKeyPath": "/id"
      }
    }
  ]
}

Is it possible to do it ? If not, is there a work around I could use to achieve this ? Thank you for your help.

crpietschmann commented 3 months ago

The data migration tool reads the json configuration when it runs. To get what you're trying to do, you'll can write a script to modify the json configuration prior to executing the data migration tool.