You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/chdb/guides/jupysql.md
+9-7Lines changed: 9 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,6 +6,8 @@ description: How to install chDB for Bun
6
6
keywords: [chdb, JupySQL]
7
7
---
8
8
9
+
import PlayersPerRank from '@site/static/images/chdb/guides/players_per_rank.png';
10
+
9
11
[JupySQL](https://jupysql.ploomber.io/en/latest/quick-start.html) is a Python library that lets you run SQL in Jupyter notebooks and the IPython shell.
10
12
In this guide, we're going to learn how to query data using chDB and JupySQL.
11
13
@@ -71,7 +73,7 @@ Next, let's import the `dbapi` module for chDB:
71
73
from chdb import dbapi
72
74
```
73
75
74
-
And we'll create a chDB connection.
76
+
And we'll create a chDB connection.
75
77
Any data that we persist will be saved to the `atp.chdb` directory:
76
78
77
79
```python
@@ -93,7 +95,7 @@ Next, we'll display the display limit so that results of queries won't be trunca
93
95
94
96
## Querying data in CSV files {#querying-data-in-csv-files}
95
97
96
-
We've downloaded a bunch of files with the `atp_rankings` prefix.
98
+
We've downloaded a bunch of files with the `atp_rankings` prefix.
97
99
Let's use the `DESCRIBE` clause to understand the schema:
98
100
99
101
@@ -273,7 +275,7 @@ We're going to write a query that finds the maximum points accumulate by each pl
273
275
274
276
```python
275
277
%%sql
276
-
SELECT name_first, name_last,
278
+
SELECT name_first, name_last,
277
279
max(points) as maxPoints,
278
280
argMax(rank, points) as rank,
279
281
argMax(ranking_date, points) as date
@@ -305,12 +307,12 @@ It's quite interesting that some of the players in this list accumulated a lot o
305
307
306
308
## Saving queries {#saving-queries}
307
309
308
-
We can save queries using the `--save` parameter on the same line as the `%%sql` magic.
310
+
We can save queries using the `--save` parameter on the same line as the `%%sql` magic.
309
311
The `--no-execute` parameter means that query execution will be skipped.
310
312
311
313
```python
312
314
%%sql --save best_points --no-execute
313
-
SELECT name_first, name_last,
315
+
SELECT name_first, name_last,
314
316
max(points) as maxPoints,
315
317
argMax(rank, points) as rank,
316
318
argMax(ranking_date, points) as date
@@ -357,7 +359,7 @@ Parameters are just normal variables:
357
359
rank =10
358
360
```
359
361
360
-
And then we can use the `{{variable}}` syntax in our query.
362
+
And then we can use the `{{variable}}` syntax in our query.
361
363
The following query finds the players who had the least number of days between when they first had a ranking in the top 10 and last had a ranking in the top 10:
0 commit comments