Change in JSON representation of Synapse Notebooks? "\r\n" → "\n"

Martin B 126 Reputation points
2024-08-20T15:12:12.1066667+00:00

Hi,

We have the git-integration enabled for our Synapse workspace (West EU).

Starting mid of last week, we are seeing a change in the JSON representation of Synapse Notebooks in git.

Linebreaks within a code cell of a notebook used to be represented by "\r\n". When committing a Notebook recently, linebreaks are represented by "\n".

before:

...
			{
				"cell_type": "markdown",
				"metadata": {
					"nteract": {
						"transient": {
							"deleting": false
						}
					}
				},
				"source": [
					"print('hello world')\r\n",
					"print('foo')\r\n",
					"\r\n",
					"print('bar')\r\n",
					"\r\n",
				]
			},
...

after:

...
			{
				"cell_type": "markdown",
				"metadata": {
					"nteract": {
						"transient": {
							"deleting": false
						}
					}
				},
				"source": [
					"print('hello world')\n",
					"print('foo')\n",
					"\n",
					"print('bar')\n",
					"\n",
				]
			},
...

This has no functional implication but it results in a rather unreadable change history in git because every line of a all code cells contain a change.

We are thinking about "migrating" all our notebooks with a batch operation so that actual content changes are visible again. However, there was no official communication concerning this convention change and we don't know if this was a mistake.

Can you please confirm that this change was intentionally and if so, why this was not communicated properly upfront?

Azure Synapse Analytics
Azure Synapse Analytics
An Azure analytics service that brings together data integration, enterprise data warehousing, and big data analytics. Previously known as Azure SQL Data Warehouse.
5,375 questions
{count} votes

Accepted answer
  1. Bhargava-MSFT 31,261 Reputation points Microsoft Employee Moderator
    2024-09-10T16:22:26.0266667+00:00

    < Since the Microsoft Q&A community has a policy that "The question author cannot accept their own answer. They can only accept answers by others ", I'll repost the solution in case you'd like to "Accept " the answer>

    Issue:

    Issue with change in the JSON representation of Synapse Notebooks in git.

    Linebreaks within a code cell of a notebook used to be represented by "\r\n". When committing a Notebook recently, linebreaks are represented by "\n".

    Solution:

    • Impact: The issue messes up customer code reviews, as all the affected lines are always displayed as being changed by the PR.
    • Notebook ending line changed from \r\n to \n after doing any change on existing notebook and commit.
    • It's due a bug and the fix has been deployed to PROD.

    Please remember to "Accept Answer" if any answer/reply helped, so that others in the community facing similar issues can easily find the solution.


1 additional answer

Sort by: Most helpful
  1. Bruce (SqlWork.com) 77,686 Reputation points Volunteer Moderator
    2024-08-20T16:40:28.99+00:00

    line endings is controlled by git configuration. maybe someone changed your defaults:

    https://docs.github.com/en/get-started/getting-started-with-git/configuring-git-to-handle-line-endings

    note: check that your files are not seen as binary, rather than text.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.