Skip to main content

A tool for converting data into ArchivesSpace JSONModel objects.

Project description

ArchivesSpace JSONModel Converter

Installation

Navigate to the top level of this repository, and run:

pip install -e .

After installation, the tool should be available as ajc, running ajc will emit a help page describing any extant subcommands.

Configuration

AJC is configured via a YAML file. Some values are hardcoded as defaults and can be omitted - currently, this is limited to an asnake_config key containing values for the default admin account of a local ASpace instance.

By default, AJC looks for a .archivesspace_jsonmodel_converter.yml in the user's home directory. A different file location can be specified via the AJC_CONFIG_FILE variable, or by providing a path to the ajc commend via the --config-file option.

Conversion of Access DB to postgresql DB

For various reasons, it's more convenient to move the data from access to another data format before trying to convert it to ASpace JSONModel objects. For this example, we will convert the data to a postgresql-compatible SQL file. Additionally, we will deal with some issues specific to the Fort Lewis DB but that will commonly occur when converting data from MDB format.

Tools

The tools we'll be using are:

  • mdbtools - a set of command line tools for accessing and working with Access DBs
  • a Linux shell with mdbtools installed
  • psql
  • a text editor of the user's choice

Process

Step 1

First, we need to create an SQL script that represents the access DB's schema. We do this with the following commend:

mdb-schema my_access_file.mdb postgres > my_postgres_schema.sql

Step 2

Next, we need to add insert statements for all the tables in the schema. This can be done via a shell loop, thusly:

for name in `mdb-tables my_access_file.mdb`; do mdb-export -I postgres my_access_file.mdb $name >> my_postgres_schema.sql; done

At this point, we have a schema with all tables, constraints, and data from the Access db - if we're very lucky, this might just import cleanly into postgres at this point.

Step 3

Assuming postgres is already set up and the user account you're logged in as can create databases:

createdb my_access_db
psql my_access_db < my_postgres_schema.sql &> psql_import_output.txt

After this completes, check the input - there's a good chance you'll see some errors - Postgres (and MySQL, and most things for that matter) are more strict about foreign keys and indexes than Access, and don't let you do things like embed a whole word document as a column value. If there are errors, open the SQL file in a text editor that supports large files, correct the errors or drop the overly strict indexes, and then drop and recreate the table and run Step 3 again. When it runs without errors, you've successfully migrated the data.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

archivesspace_jsonmodel_converter-0.0.1.tar.gz (10.1 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file archivesspace_jsonmodel_converter-0.0.1.tar.gz.

File metadata

  • Download URL: archivesspace_jsonmodel_converter-0.0.1.tar.gz
  • Upload date:
  • Size: 10.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.7.1 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.16

File hashes

Hashes for archivesspace_jsonmodel_converter-0.0.1.tar.gz
Algorithm Hash digest
SHA256 c7f6b599236f83e11e7ca29a6a93dd30c1a9ee666199279e255186d1e97e411b
MD5 ee2fac374ce2cb5a29e516fabac9d5d4
BLAKE2b-256 bec608e663a00f646e0c09800942a1cf107e215091dabe3e686239426f9fc9e7

See more details on using hashes here.

File details

Details for the file archivesspace_jsonmodel_converter-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: archivesspace_jsonmodel_converter-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 10.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.7.1 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.16

File hashes

Hashes for archivesspace_jsonmodel_converter-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e6b4ded184dd69fd4cf8f94c2542f53939acb3ae76eb75372a8d7bf0abc264e7
MD5 386933189a104f03dbbb5a9414676573
BLAKE2b-256 300e24013fa0f59d9cb24cfc0a771345307c8165d88ea142a12b559f3fc01283

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page