Provides database operations for the client using SqlAlchemy
Adds a single item to the database
Parameters: | item – The item to add to the database |
---|---|
Returns: | The item that was added |
Quick helper to add a cache record to the database
Parameters: |
|
---|---|
Returns: | the Reading that was generated |
Adds the given items to the database with the passed attributes
Parameters: | items – A list of Model instances to be added |
---|---|
Returns: | The list of items that was added (should now be populated with IDs) |
Quick helper to add a reading record to the database
Parameters: |
|
---|---|
Returns: | the Reading that was generated |
Returns all the records for a given model type
Parameters: | model – The model to return all records for |
---|---|
Returns: | A list of all records for a given model |
Clears historic session data for the given session (ref) id
Parameters: | session_id – the id of the session to clear data for |
---|
Uses the supplied engine and models to create the required table structure
Parameters: | force_drop – forces the existing tables to be dropped and recreated if True (default False) |
---|---|
Returns: | nothing |
Clears all the data for a given sessio and removes it from the session list. This process must be mirrored on the server otherwise the session will be added back into the list when a “Session List” query is carried out
Parameters: | session_id – the id of the session to be deleted |
---|
Returns ALL items which match the given query
Parameters: |
|
---|---|
Returns: | a list of all matching records |
Gets a single item from the database (the first that matches the query dict)
Parameters: |
|
---|---|
Returns: | A single model matching the query string |
Gets cached variables. If a “since” argument is applied, it only returns values that have been read since this time. If no since value is applied then it returns the most recent. All queries are limited to 50 values per variable
Parameters: | since – a UNIX timestamp to retrieve values since |
---|---|
Returns: | A list (variable) of lists (values) |
Gets the variables associated with the cache
Returns: | a list of Cache objects |
---|
Gets a config value from the database from the given key
Parameters: | key – the config key to retrieve |
---|---|
Returns: | the Config item matching the given key |
Gets the id of a category, or if none is found, create it and return the ID of the created object
Parameters: | key – the category name to get or create |
---|---|
Returns: | the id of the Category that was retrieved or added |
Gets a list of readings for a particular session
Parameters: | session_id – the ref_id of the session to get variables for. |
---|---|
Returns: | a list of Reading objects for the session ID |
Gets the variables associated with a given session :param session_id: the ref_id of the session to get variables for. :returns: a list of Reading objects
Loads fixtures from blitz.data.fixtures
Parameters: | testing – if True all fixtures are added, otherwise just configuration |
---|---|
Returns: | nothing |
Log an error to the database - this will be sent to the client
Parameters: |
|
---|---|
Returns: | the Notification that was added |
Sets a config value in the database, adding or updating as required
Parameters: |
|
---|---|
Returns: | nothing |
The redis database server - retains several documents:
Gets all the available session from the database as a list
Returns: | a list of available sessions or an empty list if there are none |
---|
Builds a list of session information in the format:
[
[ID, start timestamp, end timestamp, number of readings]
...
]
Returns: | the list of sessions |
---|
Deletes a session and all associated data from the database. The session number will not be reused
Parma session_id: | |
---|---|
the session ID to delete | |
Returns: | nothing |
Cleans out the database
Warning
USE WITH CAUTION - this will irrevocably destroy all logged session data
Returns: | nothing |
---|
Gets all messages logged during the given session ID
Parameters: | session_id – the ID of the session to return information for |
---|---|
Returns: | the readings from the session |
Gets the most recent logged variable from the database and returns it as a raw message string.
Parameters: | session_id – The id of the session to return the top variable from |
---|---|
Returns: | A string containing the last raw serial message received from a board in this session |
Gets the last ten readings from the logging session
Returns: | the list of raw serial messages |
---|
Queues a new message against the current session. If no session is being run then it logs a warning and does nothing
Parameters: | message – the message to push onto the session data |
---|