Repository navigation
xarray-sql 0.8.0 makes public what a Context records about its tables and functions. Packages built on xarray-sql, such as an accelerator that runs its queries natively, can now use these records without reaching into private names. It also fixes ways a prepared query could return stale rows.
New
Context has five new public members (#323):
Context.datasets: a read-only mapping from each table's name to the very Dataset it reads.Context.write(tables): writes new values into registered Datasets in place, all of them or none. It makes the same checks a prepared query's call makes: the same data variables, dtypes, dims and their sizes, coordinates, and NaN or NaT in the same places.Context.replacements: a read-only count, by name, of how many times each table or view has been replaced or dropped.Context.registered_functions: the scalar, aggregate or window function last registered under each name throughContext, without DataFusion's built-ins.Context.tables_read(plan): the tables and views a query's logical plan reads, including those inIN,EXISTSand scalar subqueries.
Each docstring says what its record can't see, such as changes made from Rust.
Fixes
- A prepared query no longer returns stale rows in these cases. It now raises and asks you to prepare the query again:
- after a Dataset split into a table per group of dims is registered again (#324);
- after a table it names as
datafusion.<schema>.<table>is replaced (#325); - after a view whose quoted name contains a dot is replaced (#323);
- after a
CREATE OR REPLACE TABLEfails while it runs, which drops the old table first (#326); - after
DROP SCHEMAdrops the schema of a table it reads (#326).
- Writes reach the right tables.
Changes in behavior
Contextnow overridesregister_udf,register_udafandregister_udwf, and theirderegister_counterparts, to keepregistered_functionsup to date. They behave as before otherwise.- A name given with
ASno longer counts as a view unless a view has that name, so a prepared query raises in fewer cases where nothing it reads changed.