@@ -20,8 +20,8 @@ import xarray_sql as qr
2020ds = xr.tutorial.open_dataset(' air_temperature' )
2121
2222# The same as a dask-sql Context; i.e. an Apache DataFusion Context.
23- c = qr.Context (ds)
24- c.create_table (' air' , ds, chunks = dict (time = 24 ))
23+ c = qr.XarrayContext (ds)
24+ c.from_dataset (' air' , ds, chunks = dict (time = 24 ))
2525
2626df = c.sql('''
2727 SELECT
@@ -33,10 +33,10 @@ df = c.sql('''
3333''' )
3434
3535# A table of the average temperature for each location across time.
36- df.compute ()
36+ df.to_pandas ()
3737
3838# Alternatively, you can just create the DataFrame from the Dataset:
39- df = qr.read_xarray(ds)
39+ df = qr.read_xarray(ds).to_pandas()
4040df.head()
4141```
4242
@@ -68,6 +68,9 @@ All chunks in an Xarray Dataset are transformed into a Dask DataFrame via
6868` from_map() ` and ` to_dataframe() ` . For SQL support, we just use ` dask-sql ` .
6969That's it!
7070
71+ _ 2025 update_ : This library now implements a dask-like ` from_map ` interface in
72+ pure ` datafusion ` and ` pyarrow ` , but works with the same principle!
73+
7174## Why does this work?
7275
7376Underneath Xarray, Dask, and Pandas, there are NumPy arrays. These are paged in
@@ -81,15 +84,7 @@ worth the convenience of DataFrames.
8184
8285## What are the current limitations?
8386
84- Dask doesn't support
85- ` MultiIndex ` s ([ dask/dask #1493 ] ( https://github.com/dask/dask/issues/1493 ) ). If
86- it did, I suspect performance for many types of queries would greatly improve.
87-
88- Further, while this does play well with ` dask-geopandas ` (for geospatial query
89- support), certain types of operations don't quite match standard geopandas.
90- Spatial joins come to mind as a killer feature, but only inner joins are
91- supported ([ geopandas/dask-geopandas #72 ] ( https://github.com/geopandas/dask-geopandas/issues/72 ) )
92- .
87+ _ 2025 update_ : TBD, ` datafusion ` provides a whole new world!
9388
9489## What would a deeper integration look like?
9590
0 commit comments