kangaroo Package

bucket Module

class kangaroo.bucket.Bucket(storage_format=None, storage_path=None, storage_options={})[source]

Bases: object

add_table(table)[source]

Adds a new table to the bucket

Parameters:table – an instance of kangaroo.Table
Returns:the same instance added in table
delete_table(tbl_name)[source]

Deletes a table from the bucket.

This method with raise an exception if there is no table to delete.

Parameters:tbl_table – the name of the table that we want to delete.
Raises:Exception
flush()[source]

Saves the information from memory to disk

tables

Returns the list of available tables

table Module

class kangaroo.table.Row(table=None, **kwargs)[source]

Bases: dict

idd

Returns an unique id of the row

class kangaroo.table.Table(tbl_name, tbl_index=[])[source]

Bases: object

add_index(index_name)[source]

Add a new index in the table

Parameters:index_name – The name of the index (a column in the table).
delete_index(index_name)[source]

Deletes an existing index in the table

Parameters:index_name – The name of the index
delete_row(row)[source]

Deletes a row from the table

Parameters:row – An instance of kangaroo.Row
find(**kwargs)[source]

Finds a row in the table

Example:
>> table.database.find(my_field=1, other_field__gt=50)
Parameters:kwargs – a list of params that we are going to use to filter the existing rows.
Returns:None if there is no row that matchs or an instance of Row otherwise.
find_all(**kwargs)[source]

Finds a list of rows in the table

Example:
>> table.database.find_all(my_field=1, other_field__gt=50)
Parameters:kwargs – a list of params that we are going to use to filter the existing rows.
Returns:None if there is no row that matchs or a list of Row instances otherwise.
insert(data)[source]

Inserts a new row in the table

Parameters:data – A dictionary that it’s going to define the columns of the new Row.
Returns:An instance of Row
row_updated(row, key_changed)[source]

Updates the index tree when a row it’s modified

Parameters:
  • row – An instance of kangaroo.Row
  • key_changed – The name of the column that was modified
tbl_index

Returns the list of indexs of the table :returns: A list of index names

tbl_name

Returns the name of the table :returns: an string that represents the name of the table