Skip to content

Commit 967bd1d

Browse files
authored
Merge pull request #273031 from SharonZhang1/update0423
add %history usage
2 parents b5f711d + 5aea675 commit 967bd1d

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

articles/synapse-analytics/spark/apache-spark-development-using-notebooks.md

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
title: How to use Synapse notebooks
33
description: In this article, you learn how to create and develop Synapse notebooks to do data preparation and visualization.
44
services: synapse analytics
5-
author: ruixinxu
5+
author: JeneZhang
66
ms.service: synapse-analytics
77
ms.topic: conceptual
88
ms.subservice: spark
99
ms.date: 05/08/2021
10-
ms.author: ruxu
10+
ms.author: jingzh
1111
ms.custom: devx-track-python
1212
---
1313

@@ -561,7 +561,7 @@ You can use familiar Jupyter magic commands in Synapse notebooks. Review the fol
561561
562562

563563
Available line magics:
564-
[%lsmagic](https://ipython.readthedocs.io/en/stable/interactive/magics.html#magic-lsmagic), [%time](https://ipython.readthedocs.io/en/stable/interactive/magics.html#magic-time), [%timeit](https://ipython.readthedocs.io/en/stable/interactive/magics.html#magic-timeit), [%history](https://ipython.readthedocs.io/en/stable/interactive/magics.html#magic-history), [%run](#notebook-reference), [%load](https://ipython.readthedocs.io/en/stable/interactive/magics.html#magic-load)
564+
[%lsmagic](https://ipython.readthedocs.io/en/stable/interactive/magics.html#magic-lsmagic), [%time](https://ipython.readthedocs.io/en/stable/interactive/magics.html#magic-time), [%timeit](https://ipython.readthedocs.io/en/stable/interactive/magics.html#magic-timeit), [%history](#view-the-history-of-input-commands), [%run](#notebook-reference), [%load](https://ipython.readthedocs.io/en/stable/interactive/magics.html#magic-load)
565565

566566
Available cell magics:
567567
[%%time](https://ipython.readthedocs.io/en/stable/interactive/magics.html#magic-time), [%%timeit](https://ipython.readthedocs.io/en/stable/interactive/magics.html#magic-timeit), [%%capture](https://ipython.readthedocs.io/en/stable/interactive/magics.html#cellmagic-capture), [%%writefile](https://ipython.readthedocs.io/en/stable/interactive/magics.html#cellmagic-writefile), [%%sql](#use-multiple-languages), [%%pyspark](#use-multiple-languages), [%%spark](#use-multiple-languages), [%%csharp](#use-multiple-languages), [%%html](https://ipython.readthedocs.io/en/stable/interactive/magics.html#cellmagic-html), [%%configure](#spark-session-configuration-magic-command)
@@ -652,6 +652,22 @@ customizedLogger.error("customized error message")
652652
customizedLogger.critical("customized critical message")
653653
```
654654

655+
## View the history of input commands
656+
657+
Synapse notebook support magic command ```%history``` to print the input command history that executed in the current session, comparing to the standard Jupyter Ipython command the ```%history``` works for multiple languages context in notebook.
658+
659+
``` %history [-n] [range [range ...]] ```
660+
661+
For options:
662+
- **-n**: Print execution number.
663+
664+
Where range can be:
665+
- **N**: Print code of **Nth** executed cell.
666+
- **M-N**: Print code from **Mth** to **Nth** executed cell.
667+
668+
Example:
669+
- Print input history from 1st to 2nd executed cell: ``` %history -n 1-2 ```
670+
655671
## Integrate a notebook
656672

657673
### Add a notebook to a pipeline

0 commit comments

Comments
 (0)