Skip to content

agrc/swapper

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')

About

A CLI tool to minimize downtime and preserve existing table permissions when updating data

Topics

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Packages

No packages published

Contributors 6

Languages