()
return row["event_date"] if row else datetime.utcnow()
Get the date of the first SQL auditcare record

    HACK this uses `NavigationEventAudit` since that model is likely to
    have the record with the earliest timestamp.

    NOTE this function assumes no SQL data has been archived, and that
    all auditcare data in Couch will be obsolete and/or archived before
    SQL data. It should be removed when the data in Couch is no longer
    relevant.

    NOTE the output is being hardcoded for the time historical auditcare events are copied to SQL
Get the date of the first SQL auditcare record
Get the date of the first SQL auditcare record
def get_sql_start_date():
    """Get the date of the first SQL auditcare record

    HACK this uses `NavigationEventAudit` since that model is likely to
    have the record with the earliest timestamp.

    NOTE this function assumes no SQL data has been archived, and that
    all auditcare data in Couch will be obsolete and/or archived before
    SQL data. It should be removed when the data in Couch is no longer
    relevant.

    NOTE the output is being hardcoded for the time historical auditcare events are copied to SQL
    """
    fixed_sql_start = get_fixed_start_date_for_sql()
    if fixed_sql_start:
        return fixed_sql_start
    manager = NavigationEventAudit.objects
    row = manager.order_by("event_date").values("event_date")[:1].first()
    return row["event_date"] if row else datetime.utcnow()
def get_sql_start_date ( ) : fixed_sql_start = get_fixed_start_date_for_sql ( ) if fixed_sql_start : return fixed_sql_start manager = NavigationEventAudit . objects row = manager . order_by ( "event_date" ) . values ( "event_date" ) [ : 1 ] . first ( ) return row [ "event_date" ] if row else datetime . utcnow ( )