AnsweredAssumed Answered

Need to delete tables created in default geodatabase

Question asked by vshah6 on Jul 18, 2017
Latest reply on Jul 19, 2017 by vshah6

I am currently working on a custom tool that helps me automate some of my reports. Part of the reports deliverable in a spreadsheet that has footage by each report generated. The reports are KMZs. My script runs as anticipated and created tables as the script says to, but the location in which they are being saved is the default.gdb in my local documents in the ArcGIS folder.  I need to find a way to either be able to delete the tables created in the gdb after I'm able to pull my information using python or being able to save it in a custom location. My current code looks like this:

 

import arcpy
import arcpy.mapping as map
from arcpy import env
import datetime

date = datetime.date.today()
stats = []

statesFS = {6:'California', 14:'Illinois'}
statesAbbreviationsFS = {6:'CA', 14:'IL'}
statesCDCCode = {6:'California CDC Code', 14:'Illinois CDC Code'}

for state in statesFS:
    valueStatesFS = dict.get(statesFS, state)
    valueStatesAbbreviationsFS = dict.get(statesAbbreviationsFS, state)
    valueCDCCode = dict.get(statesCDCCode, state)
    stateMapName = str(valueStatesAbbreviationsFS) +"-" + str(valueCDCCode) + "-" + str(date)
    for field in arcpy.ListFields('Input Feature Class'):
        if field.name == 'TotalFeet':
            stats.append(['TotalFeet', "SUM"])
            arcpy.Statistics_analysis('Input Feature Class', stateMapName, stats, "")

 

Any help is appreciated.

Outcomes