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.
<SPAN class="keyword token">import</SPAN> arcpy
<SPAN class="keyword token">from</SPAN> arcpy <SPAN class="keyword token">import</SPAN> env
env<SPAN class="punctuation token">.</SPAN>workspace <SPAN class="operator token">=</SPAN> <SPAN class="string token">"C:/Student/clswkt"</SPAN>
inTable <SPAN class="operator token">=</SPAN> <SPAN class="string token">"f94fd2128655d74d9788356402dc0434.csv"</SPAN>
arcpy<SPAN class="punctuation token">,</SPAN><SPAN class="punctuation token">.</SPAN>TableToTable_conversion<SPAN class="punctuation token">(</SPAN><SPAN class="string token">"inTable"</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"clswkt.gdb"</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"<feature class name>"</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="comment token"># Define field holding WKT coords </SPAN>
field1 <SPAN class="operator token">=</SPAN> <SPAN class="string token">"shape_vector_new"</SPAN>
<SPAN class="comment token"># Define field holding unique identifier (can be PVID or OBJECTID if you didn't include PVID</SPAN>
field2 <SPAN class="operator token">=</SPAN> <SPAN class="string token">"OBJECTID"</SPAN>
<SPAN class="comment token"># Redefine inTable to new table created</SPAN>
inTable <SPAN class="operator token">=</SPAN> <SPAN class="string token">"clswkt.gdb/<tablename>"</SPAN>
featureList <SPAN class="operator token">=</SPAN> <SPAN class="punctuation token">[</SPAN><SPAN class="punctuation token">]</SPAN>
cursor <SPAN class="operator token">=</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>SearchCursor<SPAN class="punctuation token">(</SPAN>inTable<SPAN class="punctuation token">)</SPAN>
row <SPAN class="operator token">=</SPAN> cursor<SPAN class="punctuation token">.</SPAN>next<SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="keyword token">while</SPAN> row<SPAN class="punctuation token">:</SPAN>
WKT <SPAN class="operator token">=</SPAN> row<SPAN class="punctuation token">.</SPAN>getValue<SPAN class="punctuation token">(</SPAN>field1<SPAN class="punctuation token">)</SPAN>
temp <SPAN class="operator token">=</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>FromWKT<SPAN class="punctuation token">(</SPAN>WKT<SPAN class="punctuation token">,</SPAN> <SPAN class="string token">""</SPAN><SPAN class="punctuation token">)</SPAN>
featureList<SPAN class="punctuation token">.</SPAN>append<SPAN class="punctuation token">(</SPAN>temp<SPAN class="punctuation token">)</SPAN>
row <SPAN class="operator token">=</SPAN> cursor<SPAN class="punctuation token">.</SPAN>next<SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="comment token"># Copy featurelist to a feature class</SPAN>
arcpy<SPAN class="punctuation token">.</SPAN>CopyFeatures_management<SPAN class="punctuation token">(</SPAN>featureList<SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"clswkt.gdb/<fcname>"</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
Thanks in advance.