SELECT t.tileid,
python manange.py es index_database
import osimport jsonfrom django.core.management.base import BaseCommand, CommandErrorfrom arches.app.models.resource import Resource
class Command(BaseCommand):
def add_arguments(self, parser):
parser.add_argument('operation', nargs='?', choices=['delete_resources',], help='Operation Type; ' + '\'delete_resources\'=Deletes resources from the database')
parser.add_argument('-s', '--source', action='store', dest='source', default='', help='Json file containing Resource instance UUIDs in an array')
def handle(self, *args, **options): if options['operation'] == 'delete_resources': self.delete_resources(json_source=options['source']) def load_json(self, json_source): """ json should be formatted ["",""] """ json_data = open(json_source) return json.load(json_data)
def delete_resources(self,json_source) uuids = load_json(json_source=source) resources_to_delete = Resource.objects.filter(resourceinstanceid__in=uuids) for r in resources_to_delete: try: r.delete() except Exception as e: print(str(e))
--
-- To post, send email to arches...@googlegroups.com. To unsubscribe, send email to archesprojec...@googlegroups.com. For more information, visit https://groups.google.com/d/forum/archesproject?hl=en
---
You received this message because you are subscribed to the Google Groups "Arches Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to archesprojec...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/archesproject/3bcf5628-d30f-47f6-a825-9031fa7f6407%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/archesproject/CA%2BZLqy8WVLUKtHUXQ6C8WoquyvYmVTxyB0AsFTyC_jXjMR%2B9cA%40mail.gmail.com.
Hi David,
I don't really have an ERD available, although someone on our team might. I'll ask around.
-- To post, send email to arches...@googlegroups.com. To unsubscribe, send email to arches...@googlegroups.com. For more information, visit https://groups.google.com/d/forum/archesproject?hl=en
---
You received this message because you are subscribed to the Google Groups "Arches Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to arches...@googlegroups.com.
SELECT resourceinstanceidfrom, resourceinstanceidto, COUNT(*)
FROM resource_x_resource
GROUP BY resourceinstanceidfrom, resourceinstanceidto
ORDER BY resourceinstanceidfrom, resourceinstanceidto;
DELETE FROM resource_x_resource
WHERE resourcexid IN (
SELECT A.resourcexid
FROM resource_x_resource A
WHERE EXISTS (SELECT B.resourcexid
FROM resource_x_resource B
WHERE B.resourceinstanceidfrom = A.resourceinstanceidfrom
AND B.resourceinstanceidto = A.resourceinstanceidto
AND B.resourcexid < A.resourcexid));
UPDATE resource_x_resource SET relationshiptype = 'http://www.cidoc-crm.org/cidoc-crm/P67_refers_to' WHERE relationshiptype='00000000-0000-0000-0000-000000000007';
python manage.py es index_resource_relations