https://github.com/agrc/swapper
A CLI tool to minimize downtime and preserve existing table permissions when updating data
https://github.com/agrc/swapper
government-app manual-tool python-package spatial-data-life-cycle terraform-managed
Last synced: about 1 month ago
JSON representation
A CLI tool to minimize downtime and preserve existing table permissions when updating data
- Host: GitHub
- URL: https://github.com/agrc/swapper
- Owner: agrc
- License: mit
- Created: 2019-11-25T18:11:59.000Z (over 6 years ago)
- Default Branch: main
- Last Pushed: 2025-11-11T17:45:19.000Z (7 months ago)
- Last Synced: 2025-11-11T19:21:01.477Z (7 months ago)
- Topics: government-app, manual-tool, python-package, spatial-data-life-cycle, terraform-managed
- Language: Python
- Homepage: https://pypi.org/project/ugrc-swapper/
- Size: 68.4 KB
- Stars: 0
- Watchers: 5
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# swapper
## This tool will
1. Take a sgid-internal feature class name (ie SGID.OWNER.FeatureClass) as input.
1. Parse the name to get the corresponding connection files in L:\sgid_to_agol\ConnectionFilesSGID
1. Check if the input sgid-internal connection file exists
1. Check if the output sgid10 connection file exists
1. Check if the sgid-internal input feature class exists
1. Copy the feature class to sgid10 named fc_temp
1. Run a function to delete the table locks on the old sgid10 feature class that's being replaced
1. Delete the sgid10 feature class that's being replaced
1. Rename the new copied feature class from fc_temp to fc
1. Update the privileges for the agrc and SearchAPI users
## Setup
### Production
1. `git clone https://github.com/agrc/swapper`
1. `cd swapper`
1. From within a virtual environment that has python 3.6+ and arcpy: `pip install .\ -U`
1. Set `SWAPPER_*` environment variables as outlined in [.env.sample].
### Development
1. Clone project.
1. Update `.env` file to be the correct path to the share folder.
1. From within a virtual environment that has python 3.6+ and arcpy: `pip install -e .[tests]`
1. `swapper ...`
1. `pytest`
## Usage
### CLI
Run `swapper` for usage information.
### From within other python code
```python
from swapper import swapper
swapper.copy_and_replace('sgid.boundaries.counties')
```