Metadata-Version: 2.4
Name: ugrc-swapper
Version: 1.2.4
Summary: Move data from one SDE database to another with minimal downtime
Home-page: https://github.com/agrc/swapper
Author: UGRC
Author-email: ugrc-developers@utah.gov
License: MIT
Project-URL: Issue Tracker, https://github.com/agrc/swapper/issues
Keywords: gis
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Topic :: Utilities
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: docopt==0.*
Requires-Dist: python-dotenv==1.*
Requires-Dist: pyodbc==5.*
Requires-Dist: xxhash==3.*
Provides-Extra: tests
Requires-Dist: pytest-cov<8,>=5; extra == "tests"
Requires-Dist: pytest-instafail==0.5.*; extra == "tests"
Requires-Dist: pytest-mock==3.*; extra == "tests"
Requires-Dist: pytest-ruff==0.*; extra == "tests"
Requires-Dist: pytest-watch==4.*; extra == "tests"
Requires-Dist: pytest==8.*; extra == "tests"
Requires-Dist: black<26,>=24; extra == "tests"
Requires-Dist: ruff==0.*; extra == "tests"
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: keywords
Dynamic: license
Dynamic: license-file
Dynamic: project-url
Dynamic: provides-extra
Dynamic: requires-dist
Dynamic: summary

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