Skip to content

v0.8.0

Latest

Choose a tag to compare

@alxmrs alxmrs released this 18 Nov 04:09
14218f2

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 through Context, without DataFusion's built-ins.
  • Context.tables_read(plan): the tables and views a query's logical plan reads, including those in IN, EXISTS and 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 TABLE fails while it runs, which drops the old table first (#326);
    • after DROP SCHEMA drops the schema of a table it reads (#326).
  • Writes reach the right tables.
    • A prepared query that names its table with the schema, such as public.a, can now write it (#322).
    • A registration that DataFusion refuses, because the name is taken, no longer redirects writes to the new Dataset (#324).
    • A write with a dim of the wrong size now fails before writing any table (#324).

Changes in behavior

  • Context now overrides register_udf, register_udaf and register_udwf, and their deregister_ counterparts, to keep registered_functions up to date. They behave as before otherwise.
  • A name given with AS no longer counts as a view unless a view has that name, so a prepared query raises in fewer cases where nothing it reads changed.