def get_hacr_triggers(channel, start, end, columns=HACR_COLUMNS, pid=None,<EOL>monitor='<STR_LIT>', selection=None, **connectkwargs):
if columns is None:<EOL><INDENT>columns = HACR_COLUMNS<EOL><DEDENT>columns = list(columns)<EOL>span = Segment(*map(to_gps, (start, end)))<EOL>selectionstr = '<STR_LIT>' % format_db_selection(selection, engine=None)[<NUM_LIT:6>:]<EOL>databases = get_database_names(start, end)<EOL>rows = []<EOL>for db in databases:<EOL><INDENT>conn = connect(db, **connectkwargs)<EOL>cursor = conn.cursor()<EOL>pids = query("<STR_LIT>"<EOL>"<STR_LIT>"<EOL>% (monitor, str(channel)), connection=conn)<EOL>for p, s, e in pids:<EOL><INDENT>if pid is not None and int(p) != int(pid):<EOL><INDENT>continue<EOL><DEDENT>tspan = Segment(float(s), float(e))<EOL>if not tspan.intersects(span):<EOL><INDENT>continue<EOL><DEDENT>q = ('<STR_LIT>'<EOL>'<STR_LIT>'<EOL>% ('<STR_LIT:U+002CU+0020>'.join(columns), int(p), span[<NUM_LIT:0>], span[<NUM_LIT:1>],<EOL>selectionstr))<EOL>n = cursor.execute(q)<EOL>if n == <NUM_LIT:0>:<EOL><INDENT>continue<EOL><DEDENT>rows.extend(cursor.fetchall())<EOL><DEDENT><DEDENT>return EventTable(rows=rows, names=columns)<EOL>
Fetch a table of HACR triggers in the given interval