Skip to main content

Move data from one SDE database to another with minimal downtime

Project description

swapper

This tool will

  1. Take a sgid-internal feature class name (ie SGID.OWNER.FeatureClass) as input.
  2. Parse the name to get the corresponding connection files in L:\sgid_to_agol\ConnectionFilesSGID
  3. Check if the input sgid-internal connection file exists
  4. Check if the output sgid10 connection file exists
  5. Check if the sgid-internal input feature class exists
  6. Copy the feature class to sgid10 named fc_temp
  7. Run a function to delete the table locks on the old sgid10 feature class that's being replaced
  8. Delete the sgid10 feature class that's being replaced
  9. Rename the new copied feature class from fc_temp to fc
  10. Update the privileges for the agrc and SearchAPI users

Setup

Production

  1. git clone https://github.com/agrc/swapper
  2. cd swapper
  3. From within a virtual environment that has python 3.6+ and arcpy: pip install .\ -U
  4. Set SWAPPER_* environment variables as outlined in [.env.sample].

Development

  1. Clone project.
  2. Update .env file to be the correct path to the share folder.
  3. From within a virtual environment that has python 3.6+ and arcpy: pip install -e .[tests]
  4. swapper ...
  5. pytest

Usage

CLI

Run swapper for usage information.

From within other python code

from swapper import swapper

swapper.copy_and_replace('sgid.boundaries.counties')

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

ugrc-swapper-1.2.2.tar.gz (7.7 kB view details)

Uploaded Source

Built Distribution

ugrc_swapper-1.2.2-py3-none-any.whl (7.2 kB view details)

Uploaded Python 3

File details

Details for the file ugrc-swapper-1.2.2.tar.gz.

File metadata

  • Download URL: ugrc-swapper-1.2.2.tar.gz
  • Upload date:
  • Size: 7.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for ugrc-swapper-1.2.2.tar.gz
Algorithm Hash digest
SHA256 ea1f701cc99924a871033a145c3b5985da5779aa8649be219a94f6766e44f762
MD5 8f4bc1b63ad0108192236c17e1f529fb
BLAKE2b-256 e0d7e15b9f5b2033aa34b6c99dd3e40abff633752fde2e90c560f443e3e95dc2

See more details on using hashes here.

File details

Details for the file ugrc_swapper-1.2.2-py3-none-any.whl.

File metadata

  • Download URL: ugrc_swapper-1.2.2-py3-none-any.whl
  • Upload date:
  • Size: 7.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for ugrc_swapper-1.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 611813e03409f5692150b891a4eb0018a011d764bf6a20edd6fd17279eb5ee7e
MD5 387930547a43f803ff3d6bcb548e2704
BLAKE2b-256 256629dfd9f1058bc0b28127086b2a02dfde73f43b7b9b72e85284c53bb320bd

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