django.db.utils.IntegrityError #12817
Replies: 1 comment 8 replies
-
Note that when you import a module, it will implicitly create copies of all the components (interfaces etc) that are defined on the module type. I think that's what's happening here: you have a device that already has an interface "B1", and then you are importing a module which tries to create another interface called "B1" on the same device. Adding column "replicate_components", "false" or "adopt_components", "true" should fix that. (I believe the first one means "don't create any components from the module type templates", and the second means "if there's already a component with the same type and name, keep it and associate it with the module")
The module ID and the device ID are two completely different things. Each time you create, delete and recreate a module, it will get a different (module) id. Adding a module will never create a new device, so the device ID won't change. But it could create new components (interfaces, frontports, powerports etc) and they will have their own database IDs too. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hey ! so I have been trying to bulk import modules using csv and running into this error :
Key (device_id, name) = (1111, B1) already exists.
duplicate key value violates unique constraint "dcim_interface_device_id_name_bffc43c4_uniq"
Now when trying to create it manually it does work but trying to import it , it fails.
I first bulk imported it and then deleted it all , when trying to do it the second time this error happens.
Also when I created a module it received an id lets say 14 and then delete it and try again it will receive a device_id of 15 even thought no device has the id 14 already, why is that?
Beta Was this translation helpful? Give feedback.
All reactions