diff --git a/ImportServerUtilities.py b/ImportServerUtilities.py index adbe653..fd1c318 100644 --- a/ImportServerUtilities.py +++ b/ImportServerUtilities.py @@ -54,6 +54,7 @@ class ImportServerUtilities: for p in Path(self.objectStore).rglob(wildcard): pid = unquote(p.name).replace('info:fedora/', '') pids.append(pid) + print(f"Total number of PIDs found: {len(pids)}") return pids # Gets all dc datastream from objectstore @@ -158,9 +159,10 @@ class ImportServerUtilities: cursor.execute(command) self.iu.conn.commit() +if __name__ == '__main__': + MS = ImportServerUtilities('ivoices') + MS.stage_files('') -MS = ImportServerUtilities('climate') -MS.build_record_from_pids('climate', 'outputs/climate_complete.csv') diff --git a/ImportUtilities.py b/ImportUtilities.py index 9956b64..edc362d 100644 --- a/ImportUtilities.py +++ b/ImportUtilities.py @@ -278,7 +278,7 @@ class ImportUtilities: # Get node_id associated with pid. def get_pids_by_content_model(self, table, content_model): cursor = self.conn.cursor() - command = f"SELECT PID from {table} where CONTENT_MODEL = '{content_model}'" + command = f"SELECT PID from {table} where CONTENT_MODEL like '%{content_model}%'" result = cursor.execute(command).fetchone() return result['node_id'] if result is not None else '' @@ -336,5 +336,4 @@ class ImportUtilities: if __name__ == '__main__': - MU = ImportUtilities('island_archives') - MU.process_full_institution('inputs/sdu_complete.csv', 'sdu') + MU = ImportUtilities('island_archives') \ No newline at end of file