# Putting SEL sequential event recorder data into a historian

**URL:** <https://forum.inductiveautomation.com/t/putting-sel-sequential-event-recorder-data-into-a-historian/12393>\
**Category:** Ignition\
**Created:** [November 22, 2016, 6:06pm UTC](https://forum.inductiveautomation.com/t/putting-sel-sequential-event-recorder-data-into-a-historian/12393 "2016-11-22T18:06:38Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![malone46844](https://avatars.discourse-cdn.com/v4/letter/m/b9bd4f/32.png) [@malone46844](https://forum.inductiveautomation.com/u/malone46844)\
**Post date:** [November 22, 2016, 6:06pm UTC](https://forum.inductiveautomation.com/t/putting-sel-sequential-event-recorder-data-into-a-historian/12393/1 "2016-11-22T18:06:38Z")

</div>

I’ve written a python script to pull SER records from an SEL relay via telnetlib. I end up with a list of lists that looks like:

`>>> 
['10', '11/11/16', '12:23:48.771', 'IN104', 'Asserted']
['9', '11/11/16', '12:23:48.771', 'TMB3A', 'Asserted']
['8', '11/11/16', '12:23:51.914', '59Q', 'Asserted']
['7', '11/11/16', '12:23:51.964', '59Q', 'Deasserted']
['6', '11/11/16', '12:23:57.924', 'IN104', 'Deasserted']
['5', '11/11/16', '12:23:57.924', 'TMB3A', 'Deasserted']
['4', '11/20/16', '08:16:06.130', '59Q', 'Asserted']
['3', '11/20/16', '08:16:06.168', '59Q', 'Deasserted']
['2', '11/20/16', '18:21:08.307', '59Q', 'Asserted']
['1', '11/20/16', '18:21:08.428', '59Q', 'Deasserted']`  
It’s easy to process this into something more useful:

`>>>
[11/11/16 12:23:48.771, IN104, True]
[11/11/16 12:23:48.771, TMB3A, True]
[11/11/16 12:23:51.914, 59Q, True]
[11/11/16 12:23:51.964, 59Q, False]
[11/11/16 12:23:57.924, IN104, False]
[11/11/16 12:23:57.924, TMB3A, False]
[11/20/16 08:16:06.130, 59Q, True]
[11/20/16 08:16:06.168, 59Q, False]
[11/20/16 06:21:08.307, 59Q, True]
[11/20/16 06:21:08.428, 59Q, False]
`  
Retrieving these records is relatively expensive in a time sense, I’m planning on running this as a gateway timer script. What is the best approach to saving this data to a database / historian for HMI viewing and long term archiving given that:

- I don’t get the data in real time.
- Retrieving records doesn’t purge them from the relay - if no events have happened since the last poll, I get the same list of events.

So far, everything historian related I’ve used the store and forward engine but I don’t get how to use that in this scenario. Is my best option to create a separate table for this data and manage adding records myself? Has anybody here already developed solutions for sequential event recorder data retrieval and storage?

Thanks.
