Skip to content

create and test arcgis pro attribute rules for uic db

Notifications You must be signed in to change notification settings

uic-utah/uic-attribute-rules

Repository files navigation

UIC Attribute Rules

Setup

  1. create local database from sql management studio named UIC

  2. enable as enterprise gdb via pro

    import arcpy
    arcpy.management.EnableEnterpriseGeodatabase(r'...\uic-attribute-rules\pro-project\localhost.sde', r'C:\Program Files\ESRI\License10.6\sysgen\keycodes')

    If you receive errors, you may need to execute the following sql

    ALTER DATABASE UIC
    SET ALLOW_SNAPSHOT_ISOLATION ON
    
    ALTER DATABASE UIC
    SET READ_COMMITTED_SNAPSHOT ON
  3. import the XML Workspace for the existing UIC database

    arcpy.management.ImportXMLWorkspaceDocument(r'...\uic-attribute-rules\pro-project\localhost.sde', r'...\uic-attribute-rules\data\UIC_STAGING.XML', 'SCHEMA_ONLY', None)
  4. Create a python conda workspace for the project

    conda create --clone arcgispro-py3 --name uic
  5. Activate the environment

    activate uic
  6. install the development requirements

    pip install -r requirements.dev.txt

Installation

Database Migrations

Update Enterprise GDB

  1. Update to >= 10.7.1

Remove feature dataset

  1. Import the individual feature classes contained within the feature datasets
  2. Import everything outside the feature dataset
  3. Need to transfer the UDEQ.UICADMIN.UICSCHEMATRONERRORCODES by hand (is this necessary?)
  4. Set the bridging / intermediate table for UICAOR to UICArtPen permissions for all users to Select, Insert, Update, and Delete
    • I think if we grant data reader and data writer plus EXECUTE to all users the above step is unnecessary
  5. Database users need to be database authentication for versions to be created correctly.
  6. All users besides SDE need to be granted EXECUTE privileges.
  7. All users need Select, Insert, Update, and Delete granted via ESRI tools

Add reference data

  1. County boundaries
  2. Municipal boundaries
  3. Zip code boundaries

python migrations

  1. add localhost.sde, stage.sde, and prod.sde to the pro-project
  2. run migration code
    • python migrations.py migrate --env=local, dev, prod

This is a doc opt cli, so check the help for the tool

What happens
  1. removes unused tables
  2. unversions tables
  3. disables editor tracking
  4. adds and removes table fields
  5. removes unused domains
  6. moves fields from one table to another
  7. creates well contingency
  8. adds editor tracking
  9. versions tables

Attribute Rules

  1. add localhost.sde, stage.sde, and prod.sde to the pro-project
  2. Install attribute rules
    • python ar.py update --env=local, dev, prod
    • You can specify --rule= to only update a tables worth of rules

This is a doc opt cli, so check the help for the tool.

Releasing

  1. Bump ar.py VERSION string
  2. Bump ruletypes.py Constraint.error_number to match in the integer form
    • Bump before you run since it adds a record to the Version_Information table
  3. Bump migration.py if it changed.
    • Bump before you run since it adds a record to the Version_Information table