Beginner here so keep that in mind!
We have a data source that can provide me with SQL output in tab delimited form that contains fields + attributes, one of which being the vector info stored as an WKT string.
I am able to bring the vector info through into a new feature class easily enough with fromWKT but I also need to bring some of the fields + values along at the same time.
Code I have for bringing just the vectors.
import arcpy
from arcpy import env
env.workspace = "C:/Student/clswkt"
inTable = "f94fd2128655d74d9788356402dc0434.csv"
arcpy,.TableToTable_conversion("inTable", "clswkt.gdb", "<feature class name>")
# Define field holding WKT coords
field1 = "shape_vector_new"
# Define field holding unique identifier (can be PVID or OBJECTID if you didn't include PVID
field2 = "OBJECTID"
# Redefine inTable to new table created
inTable = "clswkt.gdb/<tablename>"
featureList = []
cursor = arcpy.SearchCursor(inTable)
row = cursor.next()
while row:
WKT = row.getValue(field1)
temp = arcpy.FromWKT(WKT, "")
featureList.append(temp)
row = cursor.next()
# Copy featurelist to a feature class
arcpy.CopyFeatures_management(featureList, "clswkt.gdb/<fcname>")
Thanks in advance.
suggest converting the SQL output into a CSV file. Then joining that CSV file to your feature class created from your current script.