6.124. sibl_gui.components.core.database.operations

operations.py

Platform:
Windows, Linux, Mac Os X.
Description:
Defines Application Database operations objects.

Others:

6.124.1. Module Attributes

sibl_gui.components.core.database.operations.LOGGER
sibl_gui.components.core.database.operations.DATABASE_EXCEPTIONS
sibl_gui.components.core.database.operations.DEFAULT_SESSION_MAKER
sibl_gui.components.core.database.operations.DEFAULT_SESSION

6.124.2. Functions

sibl_gui.components.core.database.operations.createSession()[source]

Creates a default session.

Returns:Database session.
Return type:Session
sibl_gui.components.core.database.operations.getSession(session=None)[source]

Returns either given session or the default one.

Parameters:session (Session) – Database session.
Returns:Database session.
Return type:Session
sibl_gui.components.core.database.operations.query(*args, **kwargs)[source]

Queries given session or the default one.

Parameters:
  • *args (*) – Arguments.
  • **kwargs (**) – Keywords arguments.
Returns:

Query result.

Return type:

object

sibl_gui.components.core.database.operations.commit(session=None)[source]

Commits changes to the Database.

Parameters:session (Session) – Database session.
Returns:Database commit success.
Return type:bool
sibl_gui.components.core.database.operations.addItem(item, session=None)[source]

Adds an item to the Database.

Parameters:
  • item (Object) – Item to add.
  • session (Session) – Database session.
Returns:

Database commit success.

Return type:

bool

sibl_gui.components.core.database.operations.addStandardItem(type, name, path, collection, session=None)[source]

Adds a new standard item to the Database.

Parameters:
  • type (object) – Item type.
  • name (unicode) – Item name.
  • path (unicode) – Item path.
  • collection (unicode) – Collection id.
  • session (Session) – Database session.
Returns:

Database commit success.

Return type:

bool

sibl_gui.components.core.database.operations.removeItem(item, session=None)[source]

Removes an item from the Database.

Parameters:
  • item (Object) – Item to remove.
  • session (Session) – Database session.
Returns:

Database commit success.

Return type:

bool

sibl_gui.components.core.database.operations.removeStandardItem(type, identity, session=None)[source]

Removes a standard item from the Database.

Parameters:
  • type (object) – Item type.
  • identity (unicode) – Item id.
  • session (Session) – Database session.
Returns:

Database commit success.

Return type:

bool

sibl_gui.components.core.database.operations.updateItemContent(item, session=None)[source]

Update an item content.

Parameters:
  • item (IblSet) – Item to set content.
  • session (Session) – Database session.
Returns:

Database commit success.

Return type:

bool

sibl_gui.components.core.database.operations.updateItemLocation(item, path, session=None)[source]

Updates an item location.

Parameters:
  • item (object) – Item to update.
  • path (Path) – Item path.
  • session (Session) – Database session.
Returns:

Database commit success.

Return type:

bool

sibl_gui.components.core.database.operations.filterItems(items, pattern, field, flags=0)[source]

Filters items from the Database.

Parameters:
  • items (list) – Database items.
  • pattern (unicode) – Filtering pattern.
  • field (unicode) – Database field to search into.
  • flags (int) – Flags passed to the regex engine.
Returns:

Filtered items.

Return type:

list

sibl_gui.components.core.database.operations.itemExists(items, pattern, field, flags=0)[source]

Returns if given item exists in the Database.

Parameters:
  • items (list) – Database items.
  • pattern (unicode) – Filtering pattern.
  • field (unicode) – Database field to search into.
  • flags (int) – Flags passed to the regex engine.
Returns:

Filtered items.

Return type:

list

sibl_gui.components.core.database.operations.getIblSets(session=None)[source]

Returns the Ibl Sets from the Database.

Parameters:session (Session) – Database session.
Returns:Database Ibl Sets.
Return type:list
sibl_gui.components.core.database.operations.filterIblSets(pattern, field, flags=0, session=None)[source]

Filters the sets from the Database.

Parameters:
  • pattern (unicode) – Filtering pattern.
  • field (unicode) – Database field to search into.
  • flags (int) – Flags passed to the regex engine.
  • session (Session) – Database session.
Returns:

Filtered Ibl Sets.

Return type:

list

sibl_gui.components.core.database.operations.iblSetExists(path, session=None)[source]

Returns if given Ibl Set exists in the Database.

Parameters:
  • name (unicode) – Ibl Set path.
  • session (Session) – Database session.
Returns:

Ibl Set exists.

Return type:

bool

sibl_gui.components.core.database.operations.addIblSet(name, path, collection, session=None)[source]

Adds a new Ibl Set to the Database.

Parameters:
  • name (unicode) – Ibl Set name.
  • path (unicode) – Ibl Set path.
  • collection (unicode) – Collection id.
  • session (Session) – Database session.
Returns:

Database commit success.

Return type:

bool

sibl_gui.components.core.database.operations.removeIblSet(identity, session=None)[source]

Removes an Ibl Set from the Database.

Parameters:
  • identity (unicode) – Ibl Set id.
  • session (Session) – Database session.
Returns:

Database commit success.

Return type:

bool

sibl_gui.components.core.database.operations.updateIblSetContent(iblSet, session=None)[source]

Update an Ibl Set content.

Parameters:
  • iblSet (IblSet) – Ibl Set to set content.
  • session (Session) – Database session.
Returns:

Database commit success.

Return type:

bool

sibl_gui.components.core.database.operations.updateIblSetLocation(iblSet, path, session=None)[source]

Updates an Ibl Set location.

Parameters:
  • iblSet (IblSet) – Ibl Set to update.
  • path (Path) – Ibl Set path.
  • session (Session) – Database session.
Returns:

Database commit success.

Return type:

bool

sibl_gui.components.core.database.operations.checkIblSetsTableIntegrity(session=None)[source]

Checks sets table integrity.

Parameters:session (Session) – Database session.
Returns:Ibl Sets table erroneous items.
Return type:dict
sibl_gui.components.core.database.operations.getCollections(session=None)[source]

Returns the Collections from the Database.

Parameters:session (Session) – Database session.
Returns:Database Collections.
Return type:list
sibl_gui.components.core.database.operations.filterCollections(pattern, field, flags=0, session=None)[source]

Filters the Collections from the Database.

Parameters:
  • pattern (unicode) – Filtering pattern.
  • field (unicode) – Database field to search into.
  • flags (int) – Flags passed to the regex engine.
  • session (Session) – Database session.
Returns:

Filtered Collections.

Return type:

list

sibl_gui.components.core.database.operations.getCollectionsByType(type, session=None)[source]

Returns Collections of given type.

Parameters:
  • type (unicode) – Type name.
  • session (Session) – Database session.
Returns:

Ibl Sets Collections.

Return type:

list

sibl_gui.components.core.database.operations.filterCollectionsByType(type, pattern, field, flags=0, session=None)[source]

Filters the Ibl Sets Collections from the Database.

Parameters:
  • type (unicode) – Type name.
  • pattern (unicode) – Filtering pattern.
  • field (unicode) – Database field to search into.
  • flags (int) – Flags passed to the regex engine.
  • session (Session) – Database session.
Returns:

Filtered Collections.

Return type:

list

sibl_gui.components.core.database.operations.filterIblSetsCollections(pattern, field, flags=0, session=None)[source]

Filters the Ibl Sets Collections from the Database.

Parameters:
  • pattern (unicode) – Filtering pattern.
  • field (unicode) – Database field to search into.
  • flags (int) – Flags passed to the regex engine.
  • session (Session) – Database session.
Returns:

Filtered Collections.

Return type:

list

sibl_gui.components.core.database.operations.filterTemplatesCollections(pattern, field, flags=0, session=None)[source]

Filters the Templates Collections from the Database.

Parameters:
  • pattern (unicode) – Filtering pattern.
  • field (unicode) – Database field to search into.
  • flags (int) – Flags passed to the regex engine.
  • session (Session) – Database session.
Returns:

Filtered Collections.

Return type:

list

sibl_gui.components.core.database.operations.collectionExists(name, session=None)[source]

Returns if the Collection exists in the Database.

Parameters:
  • name (unicode) – Collection name.
  • session (Session) – Database session.
Returns:

Collection exists.

Return type:

bool

sibl_gui.components.core.database.operations.addCollection(collection, type, comment, session=None)[source]

Adds a Collection to the Database.

Parameters:
  • collection (unicode) – Collection name.
  • type (unicode) – Collection type.
  • comment (unicode) – Collection comment.
  • session (Session) – Database session.
Returns:

Database commit success.

Return type:

bool

sibl_gui.components.core.database.operations.removeCollection(identity, session=None)[source]

Removes a Collection from the Database.

Parameters:
  • identity (unicode) – Collection id.
  • session (Session) – Database session.
Returns:

Database commit success.

Return type:

bool

sibl_gui.components.core.database.operations.getCollectionsIblSets(identities, session=None)[source]

Returns Ibl Sets from Collections ids

Parameters:
  • identities (list) – Collections ids.
  • session (Session) – Database session.
Returns:

Ibl Sets list.

Return type:

list

sibl_gui.components.core.database.operations.getCollectionIblSetsCount(collection, session=None)[source]

Returns given Collection Ibl Sets count.

Parameters:
  • collection (Collection) – Collection.
  • session (Session) – Database session.
Returns:

Collection Ibl Sets count.

Return type:

int

sibl_gui.components.core.database.operations.getCollectionTemplatesCount(collection, session=None)[source]

Returns given Collection Tempates count.

Parameters:
  • collection (Collection) – Collection.
  • session (Session) – Database session.
Returns:

Collection Templates count.

Return type:

int

sibl_gui.components.core.database.operations.getTemplates(session=None)[source]

Returns the Templates from the Database.

Parameters:session (Session) – Database session.
Returns:Database Templates.
Return type:list
sibl_gui.components.core.database.operations.filterTemplates(pattern, field, flags=0, session=None)[source]

Filters the Templates from the Database.

Parameters:
  • pattern (unicode) – Filtering pattern.
  • field (unicode) – Database field to search into.
  • flags (int) – Flags passed to the regex engine.
  • session (Session) – Database session.
Returns:

Filtered Templates.

Return type:

list

sibl_gui.components.core.database.operations.templateExists(path, session=None)[source]

Returns if given Template exists in the Database.

Parameters:
  • name (unicode) – Template path.
  • session (Session) – Database session.
Returns:

Template exists.

Return type:

bool

sibl_gui.components.core.database.operations.addTemplate(name, path, collection, session=None)[source]

Adds a new Template to the Database.

Parameters:
  • name (unicode) – Template name.
  • path (unicode) – Template path.
  • collection (unicode) – Collection id.
  • session (Session) – Database session.
Returns:

Database commit success.

Return type:

bool

sibl_gui.components.core.database.operations.removeTemplate(identity, session=None)[source]

Removes a Template from the Database.

Parameters:
  • identity (unicode) – Template id.
  • session (Session) – Database session.
Returns:

Database commit success.

Return type:

bool

sibl_gui.components.core.database.operations.updateTemplateContent(template, session=None)[source]

Update a Template content.

Parameters:
  • template (Template) – Template to Template content.
  • session (Session) – Database session.
Returns:

Database commit success.

Return type:

bool

sibl_gui.components.core.database.operations.updateTemplateLocation(template, path, session=None)[source]

Updates a Template location.

Parameters:
  • template (Template) – Template to update.
  • path (Path) – Template path.
  • session (Session) – Database session.
Returns:

Database commit success.

Return type:

bool

sibl_gui.components.core.database.operations.checkTemplatesTableIntegrity(session=None)[source]

Checks Templates table integrity.

Parameters:session (Session) – Database session.
Returns:Templates table erroneous items.
Return type:dict