<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: TableToTable_conversion syntax on select fields using python in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/tabletotable-conversion-syntax-on-select-fields/m-p/389471#M30780</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;You could futz with the fieldmappings object (you can look that up in the help), but honestly the easiest way to do what you want is to create the output table with just the two fields you want, and use Append_management with the "NO_TEST" option to copy the two fields over. The fields that do not match (by name) will be ignored in the append.&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
arcpy.CreateTable_management(arcpy.env.workspace,"out.dbf")
arcpy.AddField_management("out.dbf","City","Text",field_length=20)
arcpy.AddField_management("out.dbf","Zip","text",field_length=9)
arcpy.DeleteField_management("out.dbf","ID") # dummy field created by CreateTable
arcpy.Append_management("in_table","out.dbf","NO_TEST")
&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I figured I was going to have to do this, I was just hoping that the syntax for the Table to Table conversion was easier than I feared. Good thing there are multiple ways to do things in ArcGIS or I'd of put a bullet in my machine by now. :-).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;**** Added note after running script ************&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Field created was actually called "field1" not "ID".&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ARCGIS automatically added OID field which I cannot delete (but want to) so I'm not actually getting a two field dbf but a 3 field. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have to export this dbf as a csv. Maybe I can delete the OID field then. Any hints as to how to export dbf to csv (and maybe eliminate OID field?)&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 17:52:20 GMT</pubDate>
    <dc:creator>ClaudineSicker</dc:creator>
    <dc:date>2021-12-11T17:52:20Z</dc:date>
    <item>
      <title>TableToTable_conversion syntax on select fields using python</title>
      <link>https://community.esri.com/t5/python-questions/tabletotable-conversion-syntax-on-select-fields/m-p/389469#M30778</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I want to copy a geodatabase table (Test) to a dbf table (Test.dbf) but am struggling with the field mapping. I have about ten fields but only want to export the City and Zip fields into the new Test.dbf file. I can get it to write all the fields to the new dbf file but am struggling with exporting just two. Help seemed to indicate this was possible but provided no examples.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is what I have:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;arcpy.TableToTable_conversion("Test","C:\\TestData","Test.dbf",,(["City"],["Zip"]))&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What am I doing wrong????????&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 17 Mar 2013 19:34:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/tabletotable-conversion-syntax-on-select-fields/m-p/389469#M30778</guid>
      <dc:creator>ClaudineSicker</dc:creator>
      <dc:date>2013-03-17T19:34:19Z</dc:date>
    </item>
    <item>
      <title>Re: TableToTable_conversion syntax on select fields using python</title>
      <link>https://community.esri.com/t5/python-questions/tabletotable-conversion-syntax-on-select-fields/m-p/389470#M30779</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt; I have about ten fields but only want to export the City and Zip fields into the new Test.dbf file. I can get it to write all the fields to the new dbf file but am struggling with exporting just two. &lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You could futz with the fieldmappings object (you can look that up in the help), but honestly the easiest way to do what you want is to create the output table with just the two fields you want, and use Append_management with the "NO_TEST" option to copy the two fields over. The fields that do not match (by name) will be ignored in the append.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;arcpy.CreateTable_management(arcpy.env.workspace,"out.dbf") arcpy.AddField_management("out.dbf","City","Text",field_length=20) arcpy.AddField_management("out.dbf","Zip","text",field_length=9) arcpy.DeleteField_management("out.dbf","ID") # dummy field created by CreateTable arcpy.Append_management("in_table","out.dbf","NO_TEST")&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Mar 2013 05:24:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/tabletotable-conversion-syntax-on-select-fields/m-p/389470#M30779</guid>
      <dc:creator>curtvprice</dc:creator>
      <dc:date>2013-03-18T05:24:56Z</dc:date>
    </item>
    <item>
      <title>Re: TableToTable_conversion syntax on select fields using python</title>
      <link>https://community.esri.com/t5/python-questions/tabletotable-conversion-syntax-on-select-fields/m-p/389471#M30780</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;You could futz with the fieldmappings object (you can look that up in the help), but honestly the easiest way to do what you want is to create the output table with just the two fields you want, and use Append_management with the "NO_TEST" option to copy the two fields over. The fields that do not match (by name) will be ignored in the append.&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
arcpy.CreateTable_management(arcpy.env.workspace,"out.dbf")
arcpy.AddField_management("out.dbf","City","Text",field_length=20)
arcpy.AddField_management("out.dbf","Zip","text",field_length=9)
arcpy.DeleteField_management("out.dbf","ID") # dummy field created by CreateTable
arcpy.Append_management("in_table","out.dbf","NO_TEST")
&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I figured I was going to have to do this, I was just hoping that the syntax for the Table to Table conversion was easier than I feared. Good thing there are multiple ways to do things in ArcGIS or I'd of put a bullet in my machine by now. :-).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;**** Added note after running script ************&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Field created was actually called "field1" not "ID".&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ARCGIS automatically added OID field which I cannot delete (but want to) so I'm not actually getting a two field dbf but a 3 field. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have to export this dbf as a csv. Maybe I can delete the OID field then. Any hints as to how to export dbf to csv (and maybe eliminate OID field?)&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 17:52:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/tabletotable-conversion-syntax-on-select-fields/m-p/389471#M30780</guid>
      <dc:creator>ClaudineSicker</dc:creator>
      <dc:date>2021-12-11T17:52:20Z</dc:date>
    </item>
  </channel>
</rss>

