pydent.interfaces.CRUDInterface

class pydent.interfaces.CRUDInterface(aqhttp, session)[source]

Bases: pydent.interfaces.SessionInterface

Create, Update, Delete interface.

Methods for communicating with Aquarium’s JSON controller.

Initializer for SessionInterface.

Parameters
  • aqhttp (AqHTTP) – aqhttp instance for this interface

  • session (AqSession) – session instance for this interface

__init__(aqhttp, session)

Initializer for SessionInterface.

Parameters
  • aqhttp (AqHTTP) – aqhttp instance for this interface

  • session (AqSession) – session instance for this interface

Methods

__init__(aqhttp, session)

Initializer for SessionInterface.

json_delete(model_name, model_data[, …])

json_post(model_name, model_data[, …])

json_save(model_name, model_data[, …])

rtype

dict

model_create(table, data[, params])

model_delete(table, model_id[, params])

model_update(table, model_id, data[, params])

Attributes

aqhttp

session

_json_controller(method, model_name, model_data, record_methods=None, record_getters=None)[source]

Method for creating, updating, and deleting models using Aquarium’s JSON controller.

Parameters
  • method (basestring) – Method name (e.g. “save”, “delete”)

  • model_name (basestring) – Model name

  • model_data (dict) – Additional model and method data

  • record_methods (dict) – Optional ‘record_methods’ key

  • record_getters (dict) – Optional ‘record_getters’ key

Returns

json formatter response

Return type

basestring

_model_controller(method, table, model_id, data, params=None)[source]

Method for creating, updating, and deleting models.

Parameters
  • method (str) – Request method name (one of ‘put’, ‘post’, ‘delete’

  • table (str) – Table name of model (e.g. ‘samples’ or ‘data_associations’)

  • model_id (Union[str, int, None]) – Optional model_id (not required for ‘post’)

  • data (Optional[dict]) – data

  • params – controller parameters

Returns

json formatted server response

Return type

dict