Skip to content

Commit 80bd976

Browse files
authored
incorporate review feedback from Mark
1 parent a69f3a5 commit 80bd976

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

docs/use-cases/AI_ML/jupyter-notebook.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,37 @@ df_2 = chdb.query(query, "DataFrame")
227227
df_2.head()
228228
```
229229

230+
<details>
231+
<summary>Read from multiple sources in a single step</summary>
232+
It's also possible to read from multiple sources in a single step. You could use the query below using a `JOIN` to do so:
233+
234+
```python
235+
query = f"""
236+
SELECT
237+
toYear(date) AS year,
238+
avg(price) AS avg_price, housesSold
239+
FROM remoteSecure(
240+
'****.europe-west4.gcp.clickhouse.cloud',
241+
default.pp_complete,
242+
'{username}',
243+
'{password}'
244+
) AS remote
245+
JOIN (
246+
SELECT
247+
toYear(date) AS year,
248+
sum(houses_sold)*1000 AS housesSold
249+
FROM file('/Users/datasci/Desktop/housing_in_london_monthly_variables.csv')
250+
WHERE area = 'city of london' AND houses_sold IS NOT NULL
251+
GROUP BY toYear(date)
252+
ORDER BY year
253+
) AS local ON local.year = remote.year
254+
WHERE town = 'LONDON'
255+
GROUP BY toYear(date)
256+
ORDER BY year;
257+
"""
258+
```
259+
</details>
260+
230261
<Image size="md" img={image_8} alt="dataframe preview"/>
231262

232263
Although we are missing data from 2020 onwards, we can plot the two datasets against each other for the years 1995 to 2019.

0 commit comments

Comments
 (0)