ez_database module

Inheritance diagram of ez_database

class ez_database.Database(table_name, constructor, localdb='sqlite:///local/database/ez.db')[source]

Bases: object

The Database class is a template for giving access to the SQL database. Also other databases like MySQL could be used.

UID_list()[source]

Return a list of the UIDs of all entries as strings

add_entries(entries, **kwargs)[source]

Performance function. Does not avoid duplicates like add_entry. Can be useful for syncing. You can specify chunk_size to optimize performance.

add_entry(entry, out=False)[source]

Add an entry without creating duplicates in self.table. Objects that change like users should use the update_entry function.

complement_entries(lst)[source]

Given a list of UIDs, return a list of UIDs that are not in lst

entry_string()[source]

Return a string of all entries

get_entries(UIDs)[source]

Return list of entries given the UIDs

get_entry(**kwargs)[source]
Returns entry given keyword argument component=value. Example:
table.get_entry(UID=‘123’)
in_DB(**kwargs)[source]
Returns boolean given keyword argument component=value. Example:
table.in_DB(UID=‘123’)
necessary_entries(lst)[source]

Given a list of UIDs, return a list of UIDs that are not in this database

update_entry(entry)[source]

Update an entry. It is selected in the table according to entry.UID.