{"id":15002862,"url":"https://github.com/madeiradata/cosmosdb-to-mssql-migration","last_synced_at":"2025-10-30T09:31:01.765Z","repository":{"id":72814856,"uuid":"270696551","full_name":"MadeiraData/CosmosDb-to-MSSQL-Migration","owner":"MadeiraData","description":"Simple app to migrate data from CosmosDB to SQL Server","archived":false,"fork":false,"pushed_at":"2024-01-16T20:04:31.000Z","size":44,"stargazers_count":6,"open_issues_count":3,"forks_count":4,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-02T07:41:22.884Z","etag":null,"topics":["azure","azure-cosmos-db","azure-cosmosdb","cosmos-db","cosmosdb","microsoft-sql-server","migration","migration-tool","mssql","mssqlserver","sql-server","sqlserver"],"latest_commit_sha":null,"homepage":"https://git.madeiradata.com/CosmosDb-to-MSSQL-Migration/","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MadeiraData.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-06-08T14:20:21.000Z","updated_at":"2023-09-03T03:24:59.000Z","dependencies_parsed_at":"2024-10-12T07:20:40.364Z","dependency_job_id":null,"html_url":"https://github.com/MadeiraData/CosmosDb-to-MSSQL-Migration","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MadeiraData%2FCosmosDb-to-MSSQL-Migration","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MadeiraData%2FCosmosDb-to-MSSQL-Migration/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MadeiraData%2FCosmosDb-to-MSSQL-Migration/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MadeiraData%2FCosmosDb-to-MSSQL-Migration/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MadeiraData","download_url":"https://codeload.github.com/MadeiraData/CosmosDb-to-MSSQL-Migration/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238950485,"owners_count":19557533,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["azure","azure-cosmos-db","azure-cosmosdb","cosmos-db","cosmosdb","microsoft-sql-server","migration","migration-tool","mssql","mssqlserver","sql-server","sqlserver"],"created_at":"2024-09-24T18:53:21.385Z","updated_at":"2025-10-30T09:31:01.363Z","avatar_url":"https://github.com/MadeiraData.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CosmosDb-to-MSSQL-Migration\n\nThis is a simple command-line program that migrates data from Azure CosmosDB to a Microsoft SQL Server database.\n\nIn this page:\n\n- [Arguments](#arguments)\n  - [CosmosDB](#cosmosdb)\n  - [SQLServer](#sqlserver)\n  - [FieldsToCopy](#fieldstocopy)\n- [Copying using Bulk Copy](#copying-using-bulk-copy)\n- [Copying using Table-Valued-Parameters](#copying-using-table-valued-parameters)\n- [Permissions](#permissions)\n- [Remarks](#remarks)\n- [See Also](#see-also)\n\n# Arguments\n\nEdit the `appsettings.json` file to specify the necessary parameters, as described below.\n\n## CosmosDB\n\nThe `CosmosDB` section in the settings affects the retreival of data from your Cosmos DB source.\n\n#### sourceEndPoint\n\n`sourceEndPoint` is the end-point URI of your Cosmos DB account.\nIt can be found in the **Overview** page of your Cosmos DB account in the Azure portal.\nIt can also be found in the **Keys** page of your Cosmos DB account.\n\nExample: `https://my-cosmosdb-account.documents.azure.com:443/`\n\n#### sourceAuthKey\n\n`sourceAuthKey` is either the **Primary Key** or **Secondary Key** of your Cosmos DB account.\nYou can find your keys in the **Keys** page of your Cosmos DB account in the Azure portal.\n\nExample: `ASdiodhasjda2...Ajddndf==`\n\n#### sourceDatabase\n\n`sourceDatabase` is the source database name of your Cosmos DB account.\n\nYour Cosmos DB databases can be found in the **Data Explorer** or **Browse** pages of your Cosmos DB account in the Azure portal.\n\n#### sourceCollection\n\n`sourceCollection` is the source collection name of your Cosmos DB account.\n\nYour Cosmos DB collections can be found under each database in the **Data Explorer** or **Browse** pages of your Cosmos DB account in the Azure portal.\n\n#### sourceQuery\n\n`sourceQuery` is the SQL Query to be used for retrieving the relevant data from your Cosmos DB collection.\n\nFor example: `SELECT c.Field1, c.Field2, c.Field3 FROM c`\n\n#### sourceMaxCountPerFetch\n\n`sourceMaxCountPerFetch` is the maximum number of rows to fetch per each iteration from your Cosmos DB account.\n\nIt affects the number of maximum buffered items, and the maximum fetched items.\n\nChoosing the right configuration number in this setting should be affected by your Cosmos DB configured throughput (based on RUs).\n\nThis can be affected by your Cosmos DB account scale, found in the **Scale** page of your Cosmos DB account in the Azure portal.\n\n[Click to learn more](https://docs.microsoft.com/en-us/azure/cosmos-db/scaling-throughput) about Cosmos DB Scaling throughput.\n\n## SQLServer\n\nThe `SQLServer` section in the settings affects the insertion of data into your target SQL Server database.\n\n#### targetHost\n\n`targetHost` is the host address of your SQL Server instance destination.\n\nFor example: `my-azure-sql-db.database.windows.net`\n\nYou can also specify an IP address. For example: `168.192.10.11`\n\nIf your SQL Server instance uses a TCP port other than 1433, it should be specified after a comma.\n\nFor example: `my-sql-server-host.acme.com,12345`\n\nSpecifying a named instance: `my-sql-server-host\\myNamedInstance`\n\n#### targetDatabase\n\n`targetDatabase` is the name of your SQL Server database destination.\n\nTo find your list of databases in your SQL Server instance, you can run the following SQL query:\n\n`SELECT name FROM sys.databases`\n\n#### targetUsername\n\n`targetUsername` is the SQL Authentication login name to be used for authenticating with your SQL Server.\n\n#### targetPassword\n\n`targetPassword` is the password of your SQL Authentication login name to be used for authenticating with your SQL Server.\n\n#### rowsPerChunk\n\n`rowsPerChunk` specifies the number of rows to fetch from the Cosmos DB source before inserting them as a chunk into the SQL Server destination.\n\n#### mergeProcedure\n\n`mergeProcedure` is a stored procedure to run after the insertion of each chunk of data into the SQL Server destination.\n\nThis parameter is **optional**. If you do not want such a procedure to be executed, please specify **null** as its value.\n\n#### useBulkCopy\n\n`useBulkCopy` is a **boolean** parameter specifying whether to use *SqlBulkCopy* or not.\n\nIf **true**, you must specify the `targetTable` parameter must be specified.\n\nIf **false**, will use a stored procedure with a Table-Valued-Parameter instead.\nIn such case, the `targetProcedureTVP` parameter must be specified.\n\n#### targetTable\n\n`targetTable` is the name of the table into which you want to save the data using SqlBulkCopy.\n\nIf `useBulkCopy` is **false**, the `targetTable` parameter is **optional**.\n\n#### truncateTargetTable\n\n`truncateTargetTable` is a **boolean** parameter specifying whether to truncate the `targetTable` staging table before beginning the migration process.\n\nIf `useBulkCopy` is **false**, the `truncateTargetTable` parameter is **optional**.\n\n#### targetProcedureTVP\n\n`targetProcedureTVP` is the name of a stored procedure that accepts a Table-Valued-Parameter as input.\n\nThis procedure must accept a table-valued-parameter with the fields matching the fields specified in the `FieldsToCopy` section.\n\nIf `useBulkCopy` is **true**, the `targetProcedureTVP` parameter is **optional**.\n\n## FieldsToCopy\n\nThe `FieldsToCopy` parameter is a string array used for specifying the list of fields to copy from Cosmos DB to SQL Server.\n\nIf a specified field is not returned in the Cosmos DB results, it will be sent as an empty string instead.\n\nExample:\n\n```\n  \"FieldsToCopy\": [\n    \"Field1\",\n    \"Field2\",\n    \"Field3\"\n  ]\n```\n\n# Copying using Bulk Copy\n\nTBA\n\n# Copying using Table-Valued-Parameters\n\nTBA\n\n# Permissions\n\nTBA\n\n# Remarks\n\nTBA\n\n# See Also\n\nTBA","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmadeiradata%2Fcosmosdb-to-mssql-migration","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmadeiradata%2Fcosmosdb-to-mssql-migration","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmadeiradata%2Fcosmosdb-to-mssql-migration/lists"}