Hello all,
A new 1.0 release was just registered in the General registry for the Tables.jl package.
The API has matured well over the last 1.5 years (since 2018 JuliaCon hackathon!), and we felt like it was time for an official 1.0 release. Highlights for 1.0 include:
- A ton of new documentation, including walk-throughs of using the Tables.jl interface, implementing it, and even some tips on testing
- Addition of
Tables.Row
andTables.Columns
convenience types for providing a ton of useful behaviors for objects returned fromTables.rows
andTables.columns
, including iteration, indexing, property-access, and AbstractDict methods - Polish of Tables.jl API requirements: in particular,
Tables.rows
must now return anyTables.AbstractRow
-compatible iterator, andTables.columns
must return aTables.AbstractColumns
-compatible object. The interfaces for bothTables.AbstractRow
andTables.AbstractColumns
are synchronized for consistency, both just requiringTables.getcolumn
andTables.columnnames
to be implemented - The moving out of a few “table operations” to a new TableOperations.jl package, where this kind of functionality can incubate and evolve separately from the core Tables.jl APIs
In general, the changes should be relatively straightforward, so the upgrade guide is:
For source implementations:
- If your table implemented
Tables.rows
, ensuring your row type implements the fullTables.AbstractRow
interface, instead of justgetproperty
andpropertynames
; note thatNamedTuple
s satisfy the interface by default (as they always have). For custom row types, you may consider subtypingTables.AbstractRow
to inherit a bunch of useful definitions (iteration, indexing, property-access, and AbstractDict methods) - If your table implements
Tables.columns
, ensuring the returned object satisfies the fullTables.AbstractColumns
interface, instead of justgetproperty
andpropertynames
. For custom columns types, you may consider subtypingTables.AbstractColumns
to inherit the same kind of useful default behavior asTables.AbstractRow
- Depending on the nature of your table, you may consider implementing
Tables.isrowtable
to hook into some useful default definitions
For Tables.jl consumers (or sink functions):
- Just note that by default, the “row” iterator returned by
Tables.rows
doesn’t require that the row be property-accessible anymore, but only requires thatTables.getcolumn
andTables.columnnames
be defined. - You may consider using the new
Tables.Row(row)
wrapper struct that takes the new “minimal” Tables.jl row requirement, and wraps it in a struct that subtypesTables.AbstractRow
, meaning it makes any plain row useful by defining iteration, indexing, property-access, and AbstractDict methods. This allows any row to be treated w/ the same API you would use on aNamedTuple
. - Note that
Tables.eachcolumn
used to allow passing varargs through the definition, but extra args should now be passed normally via closure; so the the old definition wasTables.eachcolumn(f, schema, row, args...)
and now it’s justTables.eachcolumn(f, schema, row)
- There also used to be a definition for
Tables.eachcolumn
for columns objects (i.e. the result of callingTables.columns(table)
), but that’s been removed in favor of wrapping a columns object withTables.Columns
, which makes the object iterable, indexable, property-accessible, and support AbstractDict methods (similar toTables.Row
). So you can just replaceTables.eachcolumn(columns)
withTables.Columns(columns)
. - There’s a new, officially supported
Tables.namedtupleiterator(table)
, in case that’s useful to anyone; it takes any Tables.jl input table source and will iterate fullNamedTuple
rows -
AbstractDict
s are now supported as “columns” objects (if they have a key type ofSymbol
,String
, orInteger
and a value type of<:AbstractVector
), or as a “row” object; meaning aVector{Dict}
is a now a valid “table”
I think those are the major things to highlight; for more complete view of the package, interfaces, and APIs, check out the new docs, feel free to open an issue for anything confusing or concerning, or drop by the #data channel in the slack to ask questions or get some clarity. Also feel free to ping me (@quinnj) on any issues/pull requests and I’m happy to review and help people get some 1.0 goodness for their tables.
Happy tabling!
-Jacob