Sensor for measuring flow in a pipeline, comprising a sensor lower part for accommodating a measuring sensor and a sensor top part for accommodating a detector or transducer, and a locking ring arranged between the two parts (2, 3), wherein the sensor lower part has a housing with a connection area on one end thereof and an attachment area on the other, opposite end thereof, for attaching the sensor to the pipeline, and the connection area has a flange that protrudes outwards, the sensor top part has a housing with a collar-like connecting element on one end thereof, the dimensions of which are greater than those of the flange on the sensor lower part, so that the connecting element can be placed over the connection area of the sensor lower part, the locking ring is arranged between the sensor lower part and the sensor top part, so that the locking ring lies flush against the connection area of the sensor lower part and cooperates with the connecting element of the sensor top part in such manner as to prevent the sensor top part from becoming detached from the sensor lower part, the locking ring has a detent element, wherein the detent cannot be released non-destructively when the locking ring is fitted between the sensor lower part and the sensor top part, wherein the sensor top part has a notch in the connecting element, into which the detent element of the locking ring extends so that the detent element of the locking ring is accessible from the outside and a movement of the locking ring relative to the connecting element is prevented; and the locking ring is embodied as an open locking ring, one end of which has a latching element and the other end of which has a latching seating for locking by engagement of the latching element in the latching seating. the sensor lower part has a housing with a connection area on one end thereof and an attachment area on the other, opposite end thereof, for attaching the sensor to the pipeline, and the connection area has a flange that protrudes outwards, the sensor top part has a housing with a collar-like connecting element on one end thereof, the dimensions of which are greater than those of the flange on the sensor lower part, so that the connecting element can be placed over the connection area of the sensor lower part, the locking ring is arranged between the sensor lower part and the sensor top part, so that the locking ring lies flush against the connection area of the sensor lower part and cooperates with the connecting element of the sensor top part in such manner as to prevent the sensor top part from becoming detached from the sensor lower part, the locking ring has a detent element, wherein the detent cannot be released non-destructively when the locking ring is fitted between the sensor lower part and the sensor top part, wherein the sensor top part has a notch in the connecting element, into which the detent element of the locking ring extends so that the detent element of the locking ring is accessible from the outside and a movement of the locking ring relative to the connecting element is prevented; and the locking ring is embodied as an open locking ring, one end of which has a latching element and the other end of which has a latching seating for locking by engagement of the latching element in the latching seating.