Skip to content

Commit 0e2dc47

Browse files
authored
refactor (#10892)
1 parent f2397d0 commit 0e2dc47

File tree

2 files changed

+31
-30
lines changed

2 files changed

+31
-30
lines changed
Lines changed: 31 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,63 @@
11
---
2-
title: Visualization Databend Data in Jupyter Notebook
3-
sidebar_label: Jupyter
2+
title: Jupyter Notebook
3+
sidebar_label: Jupyter Notebook
44
description:
5-
Visualization Databend data in Jupyter Notebook.
5+
Integrating Databend with Jupyter Notebook.
66
---
77

8+
[Jupyter Notebook](https://jupyter.org) is a web-based interactive application that enables you to create notebook documents that feature live code, interactive plots, widgets, equations, images, etc., and share these documents easily. It is also quite versatile as it can support many programming languages via kernels such as Julia, Python, Ruby, Scala, Haskell, and R.
89

9-
<p align="center">
10-
<img src="https://datafuse-1253727613.cos.ap-hongkong.myqcloud.com/integration/integration-jupyter-databend.png" width="550"/>
11-
</p>
10+
With the SQLAlchemy library in Python, you can establish a connection to Databend within a Jupyter Notebook, allowing you to execute queries and visualize your data from Databend directly in the Notebook.
1211

13-
## What is [Jupyter Notebook](https://jupyter.org/)?
12+
## Tutorial: Integrate with Jupyter Notebook
1413

15-
The Jupyter Notebook is the original web application for creating and sharing computational documents. It offers a simple, streamlined, document-centric experience.
14+
In this tutorial, you will first deploy a local Databend instance and Jupyter Notebook, and then run a sample notebook to connect to your local Databend, as well as write and visualize data within the notebook.
1615

17-
## Jupyter
16+
Before you start, make sure you have completed the following tasks:
1817

19-
### Create a Databend User
18+
- You have [Python](https://www.python.org/) installed on your system.
19+
- Download the sample notebook [databend.ipynb](https://datafuse-1253727613.cos.ap-hongkong.myqcloud.com/integration/databend.ipynb) to a local folder.
2020

21-
Connect to Databend server with MySQL client:
22-
```shell
23-
mysql -h127.0.0.1 -uroot -P3307
24-
```
21+
### Step 1. Deploy Databend
2522

26-
Create a user:
27-
```sql
28-
CREATE USER user1 IDENTIFIED BY 'abc123';
29-
```
23+
1. Follow the [Deployment Guide](https://databend.rs/doc/deploy) to deploy a local Databend.
24+
2. Create a SQL user in Databend. You will use this account to connect to Databend in Jupyter Notebook.
3025

31-
Grant privileges for the user:
3226
```sql
27+
CREATE USER user1 IDENTIFIED BY 'abc123';
3328
GRANT ALL ON *.* TO user1;
3429
```
3530

36-
See also [How To Create User](../../14-sql-commands/00-ddl/30-user/01-user-create-user.md).
31+
### Step 2. Deploy Jupyter Notebook
3732

38-
### Install Jupyter Python Package
33+
1. Install Jupyter Notebook with pip:
3934

40-
Jupyter:
4135
```shell
42-
pip install jupyterlab
4336
pip install notebook
4437
```
4538

46-
Dependencies:
39+
2. Install dependencies with pip:
40+
4741
```shell
4842
pip install sqlalchemy
4943
pip install pandas
44+
pip install pymysql
5045
```
5146

52-
### Run Jupyter Notebook
47+
### Step 3. Run Sample Notebook
48+
49+
1. Run the command below to start Jupyter Notebook:
5350

54-
Download [**databend.ipynb**](https://datafuse-1253727613.cos.ap-hongkong.myqcloud.com/integration/databend.ipynb), start the notebook:
5551
```shell
5652
jupyter notebook
5753
```
5854

59-
Run `databend.ipynb` step by step, the demo show:
60-
<p align="center">
61-
<img src="https://datafuse-1253727613.cos.ap-hongkong.myqcloud.com/integration/integration-gui-jupyter.png"/>
62-
</p>
55+
This will start up Jupyter and your default browser should start (or open a new tab) to the following URL: http://localhost:8888/tree
56+
57+
![Alt text](../../../public/img/integration/notebook-tree.png)
58+
59+
2. On the **Files** tab, navigate to the sample notebook you downloaded and open it.
60+
61+
3. In the sample notebook, run the cells in order. By doing so, you create a table containing 5 rows in your local Databend, and visualize the data with a bar chart.
62+
63+
![Alt text](../../../public/img/integration/integration-gui-jupyter.png)
202 KB
Loading

0 commit comments

Comments
 (0)