For safety it would be best to disconnect the 12v battery and wait at least a minute before disconnecting/connecting the sensor. This will prevent an accidental deployment of the bag.
Danger is bag exploding accidentally when your head is close to it. Safe is disconnecting 12V battery first and wait a few minutes before unplug connector.
Just don't turn the car on with the airbag disconnected. Some of the airbags will throw a permanent SRS code if the car is powered up while it's disconnected.