Littletable

Latest version: v2.2.5

Safety actively analyzes 630523 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 6 of 7

0.9

-------------
- Python 3 compatibility.

- (feature previously released in version 0.6 but not documented)
Added 'by' index accessor on tables, to help distinguish that the index
attributes are not attributes of the table itself, but of the objects
in the table:

using unique index 'sku' on catalog table:
print(catalog.by.sku["ANVIL-001"].descr)

using non-unique index 'state' on stations table:
stations.create_index("state")
for az_stn in stations.by.state['AZ']:
print(az_stn)

Updated inline examples to use '<table>.by.<index_name>' syntax.

0.8

-------------
- Added json_import and json_export methods to Table, with same interface
as csv_import and csv_export. The import file should contain a JSON
object string per row, or a succession of JSON objects (can be pretty-
printed), but *not* a single JSON list of objects.

- Included pivot_demo.py as part of the source distribution.

0.7

-------------
- Added support for '+=' operator, for in-place union. Unlike '+', does
not return a new Table, but instead updates the LHS table in place.

- Renamed addfield to add_field to be consistent with other two-word
method names in the Table interface. addfield is still retained for
compatibility (just calls add_field with called args); but is deprecated
and will be removed in a future version.

- Added unique() method on Table, to return a new Table with duplicate
entries removed. To support comparison of DataObjects that might be in
the table, DataObjects now support __eq__ and hash methods.

- Changed interface to Table.select(). Formerly was called as

table.select('field1','field2','field3')

But now the fields are specified as either a single space-delimited
string or a list of strings.

table.select('field1 field2 field3')

- The special '_orderby' argument to Table.where() is deprecated, since
following the where() call with sort() is so straightforward.

- The special '_unique' argument to Table.select() is deprecated, since
following the select() call with unique() is so straightforward.

0.6

-------------
- Modified __getitem__ so that retrievals of slices return new Tables
instead of just lists of objects (essentially adding sliced indexing
as another chained accessor).

- Added count_fn to the dump_counts method of PivotTable, so that a
summarizing function other than mere counting can be used for each cell
in the pivot table. Here is an example of summarizing population by
state and elevation, where each record has attributes state, elevation
(reduced to nearest 1000'), and population:

piv = places.pivot('state elevation')
piv.dump_counts(count_fn=lambda recs:sum(r.population for r in recs))

- Added sort(), initial version contributed by Adam Sah. sort will take
a key function, or a string containing comma-separated attribute names.
Attributes can be qualified with "desc" to indicated sort to be done
in descending order.

- Modified insert() and compute() to return self, for chaining support.

- Renamed maxrecs parameters to 'limit', to be more similar to the same
concept in SQL.

- Merged query and where into a single consolidated function named 'where'
for selecting matching records from a table.

- Add union function to add records of two tables. '+' between two tables
will perform union; '+' between join terms, or a table and a join term,
will perform join. Returns a new Table.

- join() verifies that all named attributes exist in one of the source
tables

- join() will automatically create indexes for join columns if indexes
do not already exist

0.5

-------------
- Added groupby() method to Table (thanks, Adam Sah!) to generate tables
of computed values keyed by an existing or computed attribute.

- Added optional name fields to clone and copy_template.

- Modified create_index and insert_many to return self, so that a
simple table creation and indexing could be done in a single chained
statement (also suggested by Adam Sah, thanks!)

- Fixed possible bug in PivotTable.values - now values are returned
in the order of matching keys returned by keys().

- Fixed bugs in Table.pivot(), see pivot_demo.py

0.4

-------------
- Added compute() method to Table to support global update of all objects
in the table, to add or modify a given attribute on each object. compute()
takes a function that computes the new or modified attribute value, taking
the entire object as its single input argument. Can override DataObject's
write-only functionality (for example, when converting attributes entered
as a string to an int or float). Also accepts a default value to use, in
case the computing function raises an exception. Useful when creating a
new attribute that would be computed based on other values in the object.

- Added transforms argument to csv_import, to simplify the conversion of
string data values to int, float, or other non-string type. The transforms
argument is a dict mapping attribute names to conversion functions, each
function taking the as-imported string value and return a new transformed
value.

Page 6 of 7

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.