-1

I know this is a duplication, but I have read all the other answers on the forum and haven't gotten any solution.

This is my code:

#Import environment settings
import os, sys, string
import arcpy

#Define Environment
arcpy.env.workspace = "Database Connections/TRANSCO_OEDEVT.sde/"
#Define connections
OEDEVT_SV = "Database Connections/TRANSCO_OEDEVT.sde/"
SQLDEVGIS = "Database Connections/DEV_SQLDEVGIS.sde"


#Check to see if any tables for write operation exists already, delete them if so
if arcpy.Exists(SQLDEVGIS + "\R_TRANSCO_PIPES"):
    print "R_TRANSCO_PIPES exists, deleting now"
    arcpy.Delete_management(SQLDEVGIS + "\PUBLISH.RISK.R_TRANSCO_PIPES")

#Define Tables
arcpy.TableToTable_conversion(
    "Database Connections/TRANSCO_OEDEVT.sde/PODSSDE.R_PIPE_SEGMENT_SV",
    "in_memory",
    "R_PIPE_SEGMENT_SV",
    "#",
"""PODS_EVENT_ID "PODS_EVENT_ID" true false false 8 Double 0 16 
    ,First,#,Database Connections/OEDEVT.sde/PODSSDE.R_PIPE_SEGMENT_SV,PODS_EVENT_ID
            ,-1,-1;MANUFACTURER_CODE "MANUFACTURER_CODE" true true false 254 Text 0 0 
    ,First,#,Database Connections/OEDEVT.sde/PODSSDE.R_PIPE_SEGMENT_SV,MANUFACTURER_CODE
            ,-1,-1;DATE_MANUFACTURED "DATE_MANUFACTURED" true true false 36 Date 0 0 
    ,First,#,Database Connections/OEDEVT.sde/PODSSDE.R_PIPE_SEGMENT_SV,DATE_MANUFACTURED
            ,-1,-1;MATERIAL_CL "MATERIAL_CL" true true false 254 Text 0 0 
    ,First,#,Database Connections/OEDEVT.sde/PODSSDE.R_PIPE_SEGMENT_SV,MATERIAL_CL
            ,-1,-1;PIPE_SPECIFICATION_CODE "PIPE_SPECIFICATION_CODE" true true false 254 Text 0 0 
    ,First,#,Database Connections/OEDEVT.sde/PODSSDE.R_PIPE_SEGMENT_SV,PIPE_SPECIFICATION_CODE
            ,-1,-1;PIPE_GRADE_CODE "PIPE_GRADE_CODE" true true false 254 Text 0 0 
    ,First,#,Database Connections/OEDEVT.sde/PODSSDE.R_PIPE_SEGMENT_SV,PIPE_GRADE_CODE
            ,-1,-1;NOMINAL_DIAMETER_CODE "NOMINAL_DIAMETER_CODE" true true false 254 Text 0 0 
    ,First,#,Database Connections/OEDEVT.sde/PODSSDE.R_PIPE_SEGMENT_SV,NOMINAL_DIAMETER_CODE
            ,-1,-1;NOMINAL_WALL_THICKNESS_CODE "NOMINAL_WALL_THICKNESS_CODE" true true false 254 Text 0 0 
    ,First,#,Database Connections/OEDEVT.sde/PODSSDE.R_PIPE_SEGMENT_SV,NOMINAL_WALL_THICKNESS_CODE
            ,-1,-1;PIPE_LONG_SEAM_GCL "PIPE_LONG_SEAM_GCL" true true false 254 Text 0 0 
    ,First,#,Database Connections/OEDEVT.sde/PODSSDE.R_PIPE_SEGMENT_SV,PIPE_LONG_SEAM_GCL
            ,-1,-1;DATE_INSTALLED "DATE_INSTALLED" true true false 36 Date 0 0 
    ,First,#,Database Connections/OEDEVT.sde/PODSSDE.R_PIPE_SEGMENT_SV,DATE_INSTALLED
            ,-1,-1;CONDITION_CODE "CONDITION_CODE" true true false 254 Text 0 0 
    ,First,#,Database Connections/OEDEVT.sde/PODSSDE.R_PIPE_SEGMENT_SV,CONDITION_CODE
            ,-1,-1;GIRTH_WELD_GCL "GIRTH_WELD_GCL" true true false 254 Text 0 0 
    ,First,#,Database Connections/OEDEVT.sde/PODSSDE.R_PIPE_SEGMENT_SV,GIRTH_WELD_GCL
            ,-1,-1;PCT100_SMYS_VAL "PCT100_SMYS_VAL" true true false 4 Long 0 5 
    ,First,#,Database Connections/OEDEVT.sde/PODSSDE.R_PIPE_SEGMENT_SV,PCT100_SMYS_VAL
            ,-1,-1;LINE_ID "LINE_ID" true false false 8 Double 0 16 
    ,First,#,Database Connections/OEDEVT.sde/PODSSDE.R_PIPE_SEGMENT_SV,LINE_ID
            ,-1,-1;DESIGNATOR "DESIGNATOR" true false false 10 Text 0 0 
    ,First,#,Database Connections/OEDEVT.sde/PODSSDE.R_PIPE_SEGMENT_SV,DESIGNATOR
            ,-1,-1;LINE_DESCRIPTION "LINE_DESCRIPTION" true true false 254 Text 0 0 
    ,First,#,Database Connections/OEDEVT.sde/PODSSDE.R_PIPE_SEGMENT_SV,LINE_DESCRIPTION
            ,-1,-1;LINE_NAME "LINE_NAME" true true false 299 Text 0 0 
    ,First,#,Database Connections/OEDEVT.sde/PODSSDE.R_PIPE_SEGMENT_SV,LINE_NAME
            ,-1,-1;LINE_TYPE "LINE_TYPE" true false false 16 Text 0 0 
    ,First,#,Database Connections/OEDEVT.sde/PODSSDE.R_PIPE_SEGMENT_SV,LINE_TYPE
            ,-1,-1;LINE_STATUS "LINE_STATUS" true false false 16 Text 0 0 
    ,First,#,Database Connections/OEDEVT.sde/PODSSDE.R_PIPE_SEGMENT_SV,LINE_STATUS
            ,-1,-1;BEG_ROUTE_ID "BEG_ROUTE_ID" true false false 8 Double 0 16 
    ,First,#,Database Connections/OEDEVT.sde/PODSSDE.R_PIPE_SEGMENT_SV,BEG_ROUTE_ID
            ,-1,-1;BEG_MEASURE "BEG_MEASURE" true false false 8 Double 2 12 
    ,First,#,Database Connections/OEDEVT.sde/PODSSDE.R_PIPE_SEGMENT_SV,BEG_MEASURE
            ,-1,-1;END_MEASURE "END_MEASURE" true false false 8 Double 2 12 
    ,First,#,Database Connections/OEDEVT.sde/PODSSDE.R_PIPE_SEGMENT_SV,END_MEASURE
            ,-1,-1""","#"
    )
print "Loaded R_PIPE_SEGMENT_SV into memory"

this is the error I get:

Traceback (most recent call last):
  File "C:/Users/fyeboah/Desktop/Testing.py", line 69, in <module>
    ,-1,-1""","#"
  File "C:\Program Files (x86)\ArcGIS\Desktop10.2\arcpy\arcpy\conversion.py", line 2018, in TableToTable
    raise e
ExecuteError: Failed to execute. Parameters are not valid.
ERROR 000732: Input Rows: Dataset Database Connections\TRANSCO_OEDEVT.sde\PODSSDE.R_PIPE_SEGMENT_SV does not exist or is not supported
Failed to execute (TableToTable).
  • Are you sure that "Database Connections\TRANSCO_OEDEVT.sde\PODSSDE.R_PIPE_SEGMENT_SV" exists and is a table file? I don't think that tool works on feature classes. – Tom Feb 1 '16 at 17:34
  • @Tom, Yes, it exists as a spatial_view. – frankyy Feb 1 '16 at 20:58
  • then if it's a spatial view--as I said--it won't work with tabletotable. You need featureclasstofeatureclass. – Tom Feb 1 '16 at 22:32
1

Two things....

1) In arcpy.Exists(SQLDEVGIS + "\R_TRANSCO_PIPES") the string "\R..." needs to be prefaced with an 'r' to denote that it is a raw string. For example, should be: arcpy.Exists(SQLDEVGIS + r"\R_TRANSCO_PIPES")

2) In this environment the _SV denotes a spatial view. If you are trying to copy featureclasses then use FeatureClassToFeatureClass_conversion

  • I added the preface 'r', but it is still giving me the same error. Could it be that I am doing something wrong? – frankyy Feb 1 '16 at 21:03
  • Change from in_memory to the file system as a test. All Transco pipe segments would be quite large in an in_memory workspace. Could trim attributes off if this destination is necessary. Also check memory as the process is occurring as another test. I believe TableToTable is not the right tool anyway and should be FeatureClassToFeatureClass. – PXR Feb 1 '16 at 21:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.