Browse Source

Loosened Content model

main
astanley 2 years ago
parent
commit
800ac5d21c
  1. 6
      ImportServerUtilities.py
  2. 3
      ImportUtilities.py

6
ImportServerUtilities.py

@ -54,6 +54,7 @@ class ImportServerUtilities:
for p in Path(self.objectStore).rglob(wildcard): for p in Path(self.objectStore).rglob(wildcard):
pid = unquote(p.name).replace('info:fedora/', '') pid = unquote(p.name).replace('info:fedora/', '')
pids.append(pid) pids.append(pid)
print(f"Total number of PIDs found: {len(pids)}")
return pids return pids
# Gets all dc datastream from objectstore # Gets all dc datastream from objectstore
@ -158,9 +159,10 @@ class ImportServerUtilities:
cursor.execute(command) cursor.execute(command)
self.iu.conn.commit() 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')

3
ImportUtilities.py

@ -278,7 +278,7 @@ class ImportUtilities:
# Get node_id associated with pid. # Get node_id associated with pid.
def get_pids_by_content_model(self, table, content_model): def get_pids_by_content_model(self, table, content_model):
cursor = self.conn.cursor() 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() result = cursor.execute(command).fetchone()
return result['node_id'] if result is not None else '' return result['node_id'] if result is not None else ''
@ -337,4 +337,3 @@ class ImportUtilities:
if __name__ == '__main__': if __name__ == '__main__':
MU = ImportUtilities('island_archives') MU = ImportUtilities('island_archives')
MU.process_full_institution('inputs/sdu_complete.csv', 'sdu')

Loading…
Cancel
Save