# Name: SetDataWorkspace_sample.py
# Description: Sets the data workspace for a job.
# Import System Modules
import arcpy
# Check Out Extensions
arcpy.CheckOutExtension('Foundation')
arcpy.CheckOutExtension('JTX')
# Setting the environment
arcpy.env.overwriteOutput = True
# Setting Local Variables
job_id = 2079
database_path = r"C:\Data\Workflows\Testing.jtc"
# Calling the Set Data Workspace tool sets the data workspace for a job
arcpy.topographic.SetDataWorkspace(job_id, database_path)
# Getting all messages, warnings, and errors from the tool run and printing the results back to the user
messages = arcpy.GetMessages(0)
warnings = arcpy.GetMessages(1)
errors = arcpy.GetMessages(2)
arcpy.AddMessage('Tool Messages: {}\nTool Warnings: {}\nTool Errors{}\n'.format(messages, warnings, errors))
# Check In Extensions
arcpy.CheckInExtension('Foundation')
arcpy.CheckInExtension('JTX')