def get_insert_cmd(insert_fields, table, update_cmd=None):
    """
    Creates the insert command to use with an insertion to a PostgreSQL database,
    given the table and the fields to be inserted

    Parameters
    ----------
    insert_fields: list of strs
        Fields of data that will be inserted
    table: str
        Name of the table being inserted into
    update_cmd:
        Update command to use when there is a conflict on the ID and event keys.
        If `None`, then defaults to "DO NOTHING" and no update is performed
    """
    if update_cmd is None:
        update_cmd = "DO NOTHING"
    insert_str = ','.join(insert_fields)
    insert_cmd = f"INSERT INTO {table} ({insert_str}) VALUES %s ON CONFLICT (id,event) {update_cmd}"

    json_array_fields = {'urls', 'description_urls'}
    template_strs = []
    for f in insert_fields:
        if f in json_array_fields:
            s = f"%({f})s::jsonb[]"
        else:
            s = f"%({f})s"
        template_strs.append(s)
    template_str = ','.join(template_strs)
    template = f"({template_str})"

    return insert_cmd,template