Exemplo n.º 1
0
def copy_tables_from_template(workspace, folder_basename):
    """Copies tables from the template database to the edit workspace - excluding TFL Lines and Schedule A"""
    arcpy.env.workspace = TFL_TEMPLATES_GDB
    feature_classes = arcpy.ListFeatureClasses()
    if feature_classes == []:
        arcpy.AddError('ERROR: no feature classes found in template database')
    else:
        for feature_class in feature_classes:
            if (str(feature_class)[-8:] == 'Boundary'):
                source = TFL_TEMPLATES_GDB + os.sep + feature_class
                #replace TFL_xx with folder_basename (e.g., TFL_39)
                destination = workspace + os.sep + folder_basename + (
                    feature_class)[6:]
                arcpy.FeatureClassToFeatureClass_conversion(
                    source, workspace, folder_basename + (feature_class)[6:])
                ##                arcpy.Copy_management(source, destination)
                arcpy.AlterAliasName(destination,
                                     folder_basename + (feature_class)[6:])
                arcpy.AddMessage('Copied ' + feature_class + ' from template')

        #reset the workspace to remove the feature dataset then copy the transaction details table
        arcpy.env.workspace = TFL_TEMPLATES_GDB[:-9]
        tables = arcpy.ListTables()
        if not tables == []:
            for table in tables:
                if table == 'TFL_XX_Transaction_Details':
                    source = TFL_TEMPLATES_GDB[:-9] + os.sep + table
                    destination = workspace[:-9] + os.sep + folder_basename + (
                        table)[6:]
                    arcpy.Copy_management(source, destination)
                    arcpy.AlterAliasName(destination,
                                         folder_basename + (table)[6:])
                    arcpy.AddMessage('Copied ' + table + ' from template')
        arcpy.AddMessage('Completed copy of tables from template database\n')
Exemplo n.º 2
0
def CreateTable(nome, aliasName):
    try:
        arcpy.CreateTable_management(arcpy.env.workspace, nome)
        arcpy.AlterAliasName(arcpy.env.workspace + "\\" + nome, aliasName)
        print u"SDE Table {} criado com sucesso".format(nome)
    except Exception as ex:
        print u"ERRO:", nome, ex.message
Exemplo n.º 3
0
def create_feature(dictionary_list, clip_extent, gdb_output):
    """ Clips the feature and assigns the alias

    Keyword arguments:
       dictionary_list -- List containing dictionary of features to clip.
       clip_extent -- Feature used to clip other features.
       gdb_output -- The file path where the .gdb will be stored\saved.
    """

    for dic in dictionary_list:

        # File path to the source file to be clipped.
        source_location = dic["source_location"]

        # File path location to save the clipped features.
        output_name = os.path.join(gdb_output, dic["output_name"])

        # Alias name to be assigned to the newly clipped feature.
        alias = dic["alias"]

        # Prints message to screen.
        arcpy.AddMessage("....Starting Creating {} Feature".format(alias))

        # Function used to clip features.
        arcpy.Clip_analysis(source_location, clip_extent, output_name)

        # Function used to assign alias.
        arcpy.AlterAliasName(output_name, alias)

        # Prints message to screen.
        arcpy.AddMessage("........Finished Creating {} Feature".format(alias))
Exemplo n.º 4
0
def CreateFeatureClass(nome, aliasName, tipo, dataset, spatialReference):
    try:
        arcpy.CreateFeatureclass_management(
            arcpy.env.workspace + "\\" + dataset, nome, tipo, "", "DISABLED",
            "DISABLED", spatialReference)
        arcpy.AlterAliasName(
            arcpy.env.workspace + "\\" + dataset + "\\" + nome, aliasName)
        print u"Feature Class {} do tipo {} criado com sucesso".format(
            dataset + "." + nome, tipo)
    except Exception as ex:
        print u"ERRO:", dataset + "." + nome, ex.message
def createTemplateGDB(schemasFolder, destinationFolder, version):

    # Creates the specified file geodatabase of the specified version

    try:
        arcpy.AddMessage("Starting: CreateTemplateGDB")

        # Create a new file gdb in supplied folder, using supplied schema specification

        # Schema details are read from CSV files created by JMSML

        # Open the schemas CSV file which contains the basic structure of the gdb
        # we are going to create

        schemaFile = os.path.join(schemasFolder, "Schemas.csv")

        with open(schemaFile, 'r') as csvFile:
            reader = csv.reader(csvFile, dialect='excel')

            # Skip the headers
            header = next(reader)

            # Read the second line, the line of data should be a geodatabase schema line

            line = next(reader)

            if line[0] == "SchemaContainer":
                arcpy.AddMessage("Creating file geodatabase " + line[1] +
                                 "...")

                gdbName = line[1] + ".gdb"
                gdbPath = os.path.join(destinationFolder, gdbName)

                arcpy.env.workspace = destinationFolder

                if (arcpy.Exists(gdbName)):
                    arcpy.Delete_management(gdbName)

                arcpy.CreateFileGDB_management(destinationFolder, gdbName,
                                               version)

                # Create a Versions table from the contents of a CSV file

                createVersionsTable(schemasFolder, gdbPath)

                # Create all the domains

                domainPath = os.path.normpath(
                    os.path.join(schemasFolder, "../name_domains_values"))
                UpdateDomains.updateDomains(domainPath, gdbPath)

                # Read the next line of data.  It should be a dataset and its metadata

                line = next(reader)

                if line[0] == "SchemaSet":
                    arcpy.AddMessage("Creating feature dataset " + line[1] +
                                     "...")

                    # Fetch the dataset's spatial reference

                    dataSet = line[1]
                    sr = arcpy.SpatialReference(int(line[17]))

                    arcpy.CreateFeatureDataset_management(gdbPath,
                                                          dataSet,
                                                          spatial_reference=sr)

                    # Read the following lines of the CSV and create a feature class for each

                    for line in reader:
                        if line[0] == "Schema":
                            fcName = line[1]
                            geoType = line[2]
                            alias = line[3]
                            srID = line[17]

                            arcpy.AddMessage("Creating feature class " +
                                             fcName + "...")

                            geometryType = geometryTypeLookup(geoType)

                            if geometryType != "NONE":
                                out_path = os.path.join(gdbPath, dataSet)

                                if srID == "":
                                    arcpy.CreateFeatureclass_management(
                                        out_path,
                                        fcName,
                                        geometryType,
                                        has_m="DISABLED",
                                        has_z="ENABLED")
                                else:
                                    sr = arcpy.SpatialReference(int(srID))
                                    arcpy.CreateFeatureclass_management(
                                        out_path,
                                        fcName,
                                        geometryType,
                                        spatial_reference=sr,
                                        has_m="DISABLED",
                                        has_z="ENABLED")

                                featureClass = os.path.join(out_path, fcName)
                                arcpy.AlterAliasName(featureClass, alias)

                                AddFieldsFromSchema.addFieldsFromSchema(
                                    schemasFolder, featureClass, fcName)

    except Exception as err:
        arcpy.AddError(
            traceback.format_exception_only(type(err), err)[0].rstrip())

    else:
        arcpy.AddMessage("Success! - Completed: CreateTemplateGDB")

    finally:
        arcpy.AddMessage("Exiting: CreateTemplateGDB")
                            arcpy.Delete_management(int_result)

                        # kdv_result.save(KDVector)

                        ResidualCon = "{}{}KernelD_GNAF2".format(out_gdb, "\\")
                        if arcpy.Exists(ResidualCon):
                            txtFile.write("Deleting: {}{}".format(ResidualCon, "\n"))
                            arcpy.Delete_management(ResidualCon)

                        ResidualCon = "{}{}Con_KernelD_1".format(out_gdb, "\\")
                        if arcpy.Exists(ResidualCon):
                            txtFile.write("Deleting: {}{}".format(ResidualCon, "\n"))
                            arcpy.Delete_management(ResidualCon)

                        if arcpy.Exists(OutputKDv):
                            arcpy.AlterAliasName(OutputKDv, KDvAlias)

                        arcpy.AddMessage(
                            "Finished: {2} - KD Raster = {0}{2} - KD Vector = {1}{2} Time - {3}{2}".format(OutputKDr,
                                                                                                           OutputKDv,
                                                                                                           "\n",
                                                                                                           time.strftime("%X")))
                        txtFile.write(
                            "Finished: {2} - KD Raster = {0}{2} - KD Vector = {1}{2} Time - {3}{2}".format(OutputKDr,
                                                                                                           OutputKDv,
                                                                                                           "\n",
                                                                                                           time.strftime("%X")))
    finally:

        arcpy.CheckInExtension("Spatial")
        arcpy.CheckInExtension("ImageAnalyst")
Exemplo n.º 7
0
if queryCountyName == "SanJuan":
    queryCountyName = "San Juan"
queryString = "NAME = '" + queryCountyName + "'"
current_step += 1
arcpy.AddMessage("[step " + str(current_step) + " of " + str(total_steps) +
                 "] Query string for county boundaries layer: " + queryString)
arcpy.MakeFeatureLayer_management(
    r"Database Connections\internal@[email protected]\SGID.BOUNDARIES.Counties",
    "counties_lyr", queryString)
arcpy.MakeFeatureLayer_management(outputFeatureClass, 'countyETL_lyr')

arcpy.SelectLayerByLocation_management('countyETL_lyr', 'intersect',
                                       "counties_lyr")
strTime = datetime.now().strftime('%H%M')
arcpy.CopyFeatures_management(
    'countyETL_lyr',
    dirname + "\\" + countyName + "ETL_" + strDate + "_" + strTime)

# Execute Delete the Utah road layer will all the segments, including segments outside the county
arcpy.Delete_management(dirname + "\\" + countyName + "Temp")

# alter the alias name
finalFeatureClassOutput = dirname + "\\" + countyName + "ETL_" + strDate + "_" + strTime

# add alias name to the feature class for use in the ArcMap Utrans Editor (was outputFeatureClass)
arcpy.AlterAliasName(finalFeatureClassOutput, "COUNTY_STREETS")

arcpy.AddMessage("ETL Process Done!")
arcpy.AddMessage(
    "*REMINDER*: Check for non-valid domains in either the UTRANS_NOTES field or the text file here L:\agrc\utrans\UtransEditing\scripts_and_tools\_script_logs\CountiesDomainValueErrors.txt"
)
Exemplo n.º 8
0
                sql_clause=(None, 'ORDER BY ' + tblPhysicalNameFld + ',' +
                            fieldSequenceFld)):
            # --------------------------------------------------- Table does NOT EXIST - Create Table
            if row[tableName] == 'analyte': continue

            if not currentTable == row[tableName]:
                currentTable = row[tableName]

                # Table does exist; capture fields to compare to master list
                if arcpy.Exists(os.path.join(pedonGDB, currentTable)):
                    currentTableFieldNames = [
                        field.name for field in arcpy.ListFields(
                            os.path.join(pedonGDB, currentTable))
                    ]
                    tblAlias = currentTable.replace('_', ' ').title()
                    arcpy.AlterAliasName(currentTable, tblAlias)
                    #AddMsgAndPrint("\n" + currentTable + " - " + row[tableAlias] + ": Already Exists!")
                    AddMsgAndPrint("\n" + currentTable + " - " + tblAlias +
                                   ": Already Exists!")

                # Create feature class for pedons
                elif currentTable == pedonTable:

                    AddMsgAndPrint("\nCreating Feature Class: " +
                                   currentTable + " - " + row[tableAlias])

                    # factory code for GCS WGS84 spatial reference
                    spatialRef = arcpy.SpatialReference(4326)
                    arcpy.CreateFeatureclass_management(
                        pedonGDB, pedonTable, "POINT", "#", "DISABLED",
                        "DISABLED", spatialRef)
Exemplo n.º 9
0
import os

# Set workspace
# env.workspace = r"C:\Users\L\Downloads\Compressed\SHP for Arcpy"
arcpy.env.overwriteOutput = True  # this for re write new data in old data and replace it

# Creating a spatial reference object

csvDataSets = r"D:\Applications\SHP for Arcpy\ArcPy Code\Created\Files/csvRenameFeatureClasss.csv"
# Set local variables
NamberOfRenameFeatreClasss = 0

# read data from csv file
csv.register_dialect("xls", delimiter=",", lineterminator="\n")
CSVcreateFeature = open(csvDataSets, "r")
dataSetReader = csv.reader(CSVcreateFeature, "xls")
for aliasFeature in dataSetReader:
    if aliasFeature[1] == aliasFeature[2]:
        out_dataset_path = r'D:\filetest\out\DWHGDB.gdb\Electercity' + '\\' + aliasFeature[
            1]
        # arcpy.CreateTable_management('c:/city/Boston.gdb', 'SnowReport')
        arcpy.AlterAliasName(out_dataset_path, aliasFeature[0])
        NamberOfRenameFeatreClasss += 1
        print 'Alias: ' + aliasFeature[
            0] + " Feeature Classs: " + aliasFeature[1]

print '----------------------------------'
print 'Finish Rename FeatureClasss'
print "Result: {} Rename FeatureClasss".format(NamberOfRenameFeatreClasss)
print '----------------------------------'
Exemplo n.º 10
0
    def do_import(self, sourcedir, agency, overwrite=True):
        """ 
        "overwrite = False" allows me to skip import to test merge
        NOTE: The arcpy workspace must be set correctly for this function's output. 
        """

        validated = agency.replace(' ', '_').replace('-', '_').replace('.', '')
        validated = validated.replace('__', '_')

        stops = os.path.join(sourcedir, agency, "stops.txt")
        routes = os.path.join(sourcedir, agency, "shapes.txt")
        agency = os.path.join(sourcedir, agency, "agency.txt")

        stops_fc = validated + "_stops"
        routes_fc = validated + "_routes"
        agency_table = validated + "_agency"

        count = 0
        try:
            if os.path.exists(routes):
                if arcpy.Exists(routes_fc) and overwrite:
                    arcpy.conversion.GTFSShapesToFeatures(
                        in_gtfs_shapes_file=routes,
                        out_feature_class=routes_fc)
                count += 1

            if os.path.exists(stops):
                if arcpy.Exists(stops_fc) and overwrite:
                    arcpy.conversion.GTFSStopsToFeatures(
                        in_gtfs_stops_file=stops, out_feature_class=stops_fc)
                count += 1

            if os.path.exists(agency):
                if arcpy.Exists(agency_table) and overwrite:
                    arcpy.conversion.TableToTable(agency, self.workspace,
                                                  agency_table)
                count += 1

        except Exception as e:
            print("   Conversion failed for \"%s\", %s" % (agency, e))
            return None

        if count == 0:
            print("   No data found here.")
            return None

        try:
            if arcpy.Exists(stops_fc):
                arcpy.AlterAliasName(stops_fc, agency + ' stops')
        except Exception as e:
            print("  Warning: setting alias failed for \"%s\", %s" %
                  (stops_fc, e))

        try:
            if arcpy.Exists(routes_fc):
                arcpy.AlterAliasName(routes_fc, agency + ' routes')
        except Exception as e:
            print("  Warning: setting alias failed for \"%s\", %s" %
                  (routes_fc, e))

        routes_layer = routes_fc + '_lyr'
        stops_layer = stops_fc + '_lyr'
        arcpy.MakeFeatureLayer_management(routes_fc, routes_layer)
        arcpy.MakeFeatureLayer_management(stops_fc, stops_layer)

        return (routes_layer, stops_layer, agency_table)
Exemplo n.º 11
0
import arcpy

arcpy.AlterAliasName(
    r'D:\filetest\out\DWHGDB.gdb\WaterNetwork\DesalinatedWaterPipes',
    'خطوط مياه محلاة')
print 'finish'
Exemplo n.º 12
0
        # arcpy.AlterAliasName(table.cell(0, 0).value, table.cell(0, 1).value)
        # for j in range(nrows):
        #     if table.cell(j, 1).value == "":
        #         continue
        #     # for k in range(1,ncols):
        #     try:
        #         arcpy.AddField_management(table.cell(0, 0).value, table.cell(j, 2).value,
        #                                   table.cell(j, 4).value.upper(),
        #                                   field_length=table.cell(j, 5).value, field_alias=table.cell(j, 3).value)
        #
        #     except Exception as e:
        #         print e

    elif myworkbook.sheet_names()[i] == 'Sheet4':
        arcpy.CreateTable_management(arcpy.env.workspace,
                                     table.cell(2, 0).value)
        arcpy.AlterAliasName(table.cell(0, 0).value, table.cell(0, 1).value)
        for j in range(nrows):
            if table.cell(j, 1).value == "":
                continue
            # for k in range(1,ncols):
            try:
                arcpy.AddField_management(table.cell(0, 0).value,
                                          table.cell(j, 2).value,
                                          table.cell(j, 4).value.upper(),
                                          field_length=table.cell(j, 5).value,
                                          field_alias=table.cell(j, 3).value)

            except Exception as e:
                print e
Exemplo n.º 13
0
                                                                  max_vertices_per_feature=None)

                    arcpy.Delete_management(int_result)

                    ResidualCon = "{}{}KernelD_GNAF2".format(out_gdb, "\\")
                    if arcpy.Exists(ResidualCon):
                        txtFile.write("Deleting: {}{}".format(ResidualCon, "\n"))
                        arcpy.Delete_management(ResidualCon)

                    ResidualCon = "{}{}Con_KernelD_1".format(out_gdb, "\\")
                    if arcpy.Exists(ResidualCon):
                        txtFile.write("Deleting: {}{}".format(ResidualCon, "\n"))
                        arcpy.Delete_management(ResidualCon)

                if arcpy.Exists(KDVector):
                    arcpy.AlterAliasName(KDVector, KDvAlias)

                arcpy.AddMessage(
                    "Finished: {2} - KD Raster = {0}{2} - KD Vector = {1}{2} Time - {3}{2}".format(KDRaster,
                                                                                                   KDVector, "\n",
                                                                                                   time.strftime(
                                                                                                       "%X")))
                txtFile.write(
                    "Finished: {2} - KD Raster = {0}{2} - KD Vector = {1}{2} Time - {3}{2}".format(KDRaster,
                                                                                                   KDVector, "\n",
                                                                                                   time.strftime(
                                                                                                       "%X")))
    finally:

        if HoldKDRaster == 'false' and arcpy.Exists(KDRaster):
            arcpy.Delete_management(KDRaster)
arcpy.AddField_management(dfcOutput, 'EDITOR', 'TEXT', '', '', 20, 'Editor')
arcpy.AddField_management(dfcOutput, 'EDIT_DATE', 'DATE', '', '', '',
                          'EditDate')
arcpy.AddField_management(dfcOutput, 'DATE_ADDED', 'DATE', '', '', '',
                          'DateAdded')
arcpy.AddField_management(dfcOutput, 'COFIPS', 'TEXT', '', '', 5, 'County')

## update the date added field with today's date and the copfips field with the county number
strTimeNow = time.strftime("%c")
strCountyNumber = expresstion[-6:-1]
fields = ['DATE_ADDED', 'COFIPS']

with arcpy.da.UpdateCursor(dfcOutput, fields) as cursor:
    for row in cursor:
        row[0] = strTimeNow
        row[1] = strCountyNumber
        cursor.updateRow(row)

arcpy.AddMessage("Begin changing feature class alias name...")
# add alias name to the feature class for use in the ArcMap Utrans Editor
arcpy.AlterAliasName(dfcOutput, "DFC_RESULT")

## append the new rows to dfc on sde
arcpy.MakeFeatureLayer_management(dfcOutput, "dfcOutput_DefQueryLyr",
                                  "CHANGE_TYPE NOT IN ('NC','D')")
outLocation = r"Database Connections\DC_TRANSADMIN@[email protected]\UTRANS.TRANSADMIN.Centerlines_Edit\UTRANS.TRANSADMIN.DFC_RESULT"
schemaType = "NO_TEST"
fieldMappings = ""
subtype = ""
arcpy.Append_management("dfcOutput_DefQueryLyr", outLocation, schemaType,
                        fieldMappings, subtype)
    if not fldName or not fldAlias:
        raise ExitError, "\nNecessary fields are missing from field alias table: " + fldName + " OR " + fldAlias

    fldAliasDict = dict()
    with arcpy.da.SearchCursor(aliasFieldTbl, [fldName,fldAlias]) as cursor:
        for row in cursor:
            if not fldAliasDict.has_key(row[0]):
                fldAliasDict[row[0]] = row[1]

    """ ------------------------------------------ Update Table and Field Aliases ------------------------------------"""
    missingAliases = dict()
    for table in nasisPedonsTables:

        if tblAliasDict.has_key(table):
            arcpy.AlterAliasName(table,tblAliasDict.get(table))
            AddMsgAndPrint("\n" + table + ": " + tblAliasDict.get(table))
        else:
            AddMsgAndPrint("\n" + table + ": No alias found!")

        i = 1
        fields = arcpy.ListFields(table)
        for field in fields:

            if field.name == "OBJECTID" or field.name == "SHAPE":continue

            if fldAliasDict.has_key(field.name):
                try:
                    alias = fldAliasDict.get(field.name)
                    arcpy.AlterField_management(table,field.name,"#",alias)
                    AddMsgAndPrint("\t\t" + str(i) + ". " + field.name + " - " + alias)
Exemplo n.º 16
0
    if len(rows) > 1:
        print('Aerial Cable count: %i in %s') % (len(rows), tbl)
    return len(rows)


flds = [fld.name for fld in arcpy.ListFields(sourceFC)]
for fld in removeFields:
    flds.remove(fld)
flds.append('SHAPE@')

if not arcpy.Exists(destFC):
    print 'Creating:', destFC
    arcpy.CreateFeatureclass_management(fds, "AerialCable", "POLYLINE",
                                        sourceFC, "SAME_AS_TEMPLATE",
                                        "SAME_AS_TEMPLATE", sr)
    arcpy.AlterAliasName(destFC, 'Aerial Cable')
else:
    print('{0} exists, truncating table').format(destFC)
    arcpy.TruncateTable_management(destFC)

with arcpy.da.Editor(wksp) as edit:
    ic = arcpy.da.InsertCursor(destFC, flds)
    print 'Inserting Aerial Cable...'
    with arcpy.da.SearchCursor(sourceFC, flds, whereSQL) as sc:
        for row in sc:
            ic.insertRow(row)

arcpy.RecalculateFeatureClassExtent_management(destFC)
getRowCount(destFC, ["*"], whereSQL)
getRowCount(sourceFC, ["*"], whereSQL)
#result = arcpy.GetCount_management(searchTable)
Exemplo n.º 17
0
import arcpy

# fGDB variables
OH_Primary = r'C:\arcdata\transfer\MIMS_Electric_Extract.gdb\Electric\ePriOHElectricLineCond'
UG_Primary = r'C:\arcdata\transfer\MIMS_Electric_Extract.gdb\Electric\ePriUGElectricLineCond'
mimsFDS = r'C:\arcdata\transfer\MIMS_Electric_Extract.gdb\MIMS'
backbone = r'C:\arcdata\transfer\MIMS_Electric_Extract.gdb\MIMS\mmBackbone'

arcpy.CreateFeatureclass_management(mimsFDS, 'mmBackbone', 'POLYLINE')
arcpy.AlterAliasName(backbone, 'Backbone')
arcpy.AddField_management(backbone,
                          'FEEDERID',
                          'TEXT',
                          field_alias='Circuit Number')
arcpy.MakeFeatureLayer_management(OH_Primary, 'OHBackbone',
                                  "BACKBONEINDICATOR = 'Y'")
arcpy.MakeFeatureLayer_management(UG_Primary, 'UGBackbone',
                                  "BACKBONEINDICATOR = 'Y'")
arcpy.Append_management(['OHBackbone', 'UGBackbone'], backbone, 'NO_TEST')

arcpy.RecalculateFeatureClassExtent_management(backbone)
result = arcpy.GetCount_management(backbone)
print('Total Backbone '), int(result.getOutput(0))
print 'finished'
template = r"D:\智能化管线项目\新气\新气数据处理\新气建设期转到新气数据库\new20190709gdb_hww\new20190709.gdb\Pipe_Risk"
arcpy.env.workspace = r'Database Connections\Connection to 127.0.0.1.sde'
# arcpy.env.workspace = r'D:\智能化管线项目\新气\新气数据处理\新气数据入库_0916\新库0910zlm.gdb'#r'Database Connections\Connection to 10.246.146.120.sde'#r"D:\智能化管线项目\销售华北1023数据表字段add\总部空库20180105.gdb"
arcpy.env.workspace = r'Database Connections\Connection to 10.246.146.120.sde'  #r"D:\智能化管线项目\销售华北1023数据表字段add\总部空库20180105.gdb"
xlspath = r"D:\智能化管线项目\新气\新气数据处理\标准数据库-20200115.xlsx".decode('utf-8')
myworkbook = xlrd.open_workbook(xlspath)
for i in range(myworkbook.nsheets):

    table = myworkbook.sheet_by_index(i)  # 定位到sheet页
    ncols = table.ncols
    nrows = table.nrows
    #全部为属性表
    print myworkbook.sheet_names()[i]
    arcpy.CreateTable_management(arcpy.env.workspace, table.cell(2, 0).value)
    arcpy.AlterAliasName(table.cell(2, 0).value, table.cell(1, 0).value)
    addfld()
    #有空间表的情况
    # if i == 0 or i == myworkbook.nsheets-1:
    #     print myworkbook.sheet_names()[i]
    #     # arcpy.CreateFeatureclass_management()
    #     arcpy.CreateFeatureclass_management("SDE.Pipe_Integrity",table.cell(2,0).value,"POLYLINE","",'ENABLED', 'DISABLED', template)
    #     arcpy.AlterAliasName(table.cell(2,0).value,table.cell(1,0).value)
    #     addfld()
    # # elif i == 1:
    # #     arcpy.CreateFeatureclass_management("Pipe_Risk", table.cell(2, 0).value, "POLYLINE", "", 'ENABLED', 'ENABLED',
    # #                                         template)
    # #     arcpy.AlterAliasName(table.cell(2, 0).value, table.cell(1, 0).value)
    # #     addfld()
    # else:
    #     print myworkbook.sheet_names()[i]