Access sde using arcpy from another system on LAN

by Ebola   Last Updated January 14, 2018 08:22 AM

I wrote a arcpy script on another PC to update my enterprise geodatbase.

import csv
import glob
import arcpy
from arcpy import env

with open('col/All.csv', 'wb') as f:
    spamwriter = csv.writer(f)
    t=0
    for filename in glob.iglob('*.csv'):
        with open(filename, 'rb') as csvfile:
            included_cols = [1,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94]
            spamreader = csv.reader(csvfile)
            header = spamreader.next()
            if t == 0:
                headers = list(header[i] for i in included_cols)
                headers.append('Types')
                headers.append('Dates')
                headers.append('Runs')
                headers.append('RunSss')
                spamwriter.writerow(headers)
            t+=1
            for row in spamreader:
                content = list(row[i] for i in included_cols)
                merged = ''
                for k in range(2,len(content)):
                    #s = "%8.2f" % content[k]
                    merged = merged + content[k] +','
                data = filename.split("_")
                data = data[3]
                date = str(data[4:6] + '/' + data[6:8] + '/' + data[:4])
                run = str(data[8:10])
                content.append('All')
                content.append(date)
                content.append(run)
                content.append(merged)
                spamwriter.writerow(content)

env.workspace = "Database Connections\SQLServer.SDE.sde"
# Overwrite the outputs of geoprocessing operations
env.overwriteOutput = True
#Table to SDE
inTable = "F:/webServer/test/10DayPeriodData/All/col/All.csv"
outLocation = "Database Connections\SQLServer.SDE.sde"
outTable = "sb3_All"
# Execute TableToTable
arcpy.TableToTable_conversion(inTable, outLocation, outTable)

This script is reading all the csv files in a folder and create another csv (All.csv) that includes all of them. Then All.csv must be inserted to the enterprise geodatabase. I have used SQL Server 2008, ArcGIS 10.2 and ArcGIS server 10.2.

When I execute this script I get this error: ArcPy Error

I should mention that I have created database connection file (.sde) in the server "SQLServer.SDE.sde" and copied it to the other system.



Related Questions


Synchronize Replication Error

Updated June 15, 2017 07:22 AM

Using ArcPy to copy to ArcSDE database?

Updated October 06, 2017 23:22 PM



Accessing differing geodatabase schemas from arcpy

Updated March 21, 2017 19:22 PM