File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -227,6 +227,37 @@ df_2 = chdb.query(query, "DataFrame")
227227df_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
232263Although we are missing data from 2020 onwards, we can plot the two datasets against each other for the years 1995 to 2019.
You can’t perform that action at this time.
0 commit comments