<?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: Table to Table from CSV - inconsistent data type in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/table-to-table-from-csv-inconsistent-data-type/m-p/501550#M39387</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Curtis!&amp;nbsp; I hadn't noticed that the schema.ini file was getting created after my first run, and creating my own solved my problem.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 07 Nov 2014 14:44:42 GMT</pubDate>
    <dc:creator>AshleyDePottey</dc:creator>
    <dc:date>2014-11-07T14:44:42Z</dc:date>
    <item>
      <title>Table to Table from CSV - inconsistent data type</title>
      <link>https://community.esri.com/t5/python-questions/table-to-table-from-csv-inconsistent-data-type/m-p/501548#M39385</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The first time I do a TableToTable conversion from a CSV into memory, it creates my PIN field as a LONG, but the second time, it creates it as TEXT.&amp;nbsp; This happens consistently whenever I move my input CSV into a new folder and causes my second TableToTable (which uses a where clause) to fail.&amp;nbsp; Any ideas why this is happening?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="python" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_14152080982507328" jivemacro_uid="_14152080982507328" modifiedtitle="true"&gt;
&lt;P&gt;csv = r'C:\temp\PostalAddress.csv'&lt;/P&gt;
&lt;P&gt;out_workspace = r'C:\temp\temp.gdb'&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;# add OID field&lt;/P&gt;
&lt;P&gt;print 'creating a copy of table with OID field'&lt;/P&gt;
&lt;P&gt;arcpy.TableToTable_conversion(csv, 'in_memory', 'unfiltered')&lt;/P&gt;
&lt;P&gt;addr_csv = os.path.join('in_memory', 'unfiltered')&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;# select only status=active and PIN &amp;lt;&amp;gt; 99*&lt;/P&gt;
&lt;P&gt;print 'filtering table for active rows'&lt;/P&gt;
&lt;P&gt;where = "UPPER(status) = 'ACTIVE' and PIN NOT LIKE '99%'"&lt;/P&gt;
&lt;P&gt;arcpy.TableToTable_conversion(addr_csv, out_workspace, 'addr', where)&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;BR /&gt;Ashley&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Nov 2014 17:35:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/table-to-table-from-csv-inconsistent-data-type/m-p/501548#M39385</guid>
      <dc:creator>AshleyDePottey</dc:creator>
      <dc:date>2014-11-05T17:35:05Z</dc:date>
    </item>
    <item>
      <title>Re: Table to Table from CSV - inconsistent data type</title>
      <link>https://community.esri.com/t5/python-questions/table-to-table-from-csv-inconsistent-data-type/m-p/501549#M39386</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The only way you can have full control over data types of fields from text tables is to write field control records to the schema.ini file in the folder. The schema.ini file is generated the first time you do a table read in that workspace - the data types are guessed based on the input data. It's nasty, but futzing with the schema.ini is the only way (unless you read the data some other way than directly as an ArcGIS table.&amp;nbsp; Fortunately Python is really great at manipulating text so you can do this using python text file operations.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;One workaround you may want to try is to delete the schema.ini file after the first TableToTable conversion - don't know if that will help though. Probably better to write a schema.ini file before you run Table To Table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.2/index.html#//005s00000010000000"&gt;Desktop 10.2 Help: Adding an ASCII or text file table &amp;gt; Overriding how text files are formatted&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Nov 2014 06:15:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/table-to-table-from-csv-inconsistent-data-type/m-p/501549#M39386</guid>
      <dc:creator>curtvprice</dc:creator>
      <dc:date>2014-11-07T06:15:53Z</dc:date>
    </item>
    <item>
      <title>Re: Table to Table from CSV - inconsistent data type</title>
      <link>https://community.esri.com/t5/python-questions/table-to-table-from-csv-inconsistent-data-type/m-p/501550#M39387</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Curtis!&amp;nbsp; I hadn't noticed that the schema.ini file was getting created after my first run, and creating my own solved my problem.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Nov 2014 14:44:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/table-to-table-from-csv-inconsistent-data-type/m-p/501550#M39387</guid>
      <dc:creator>AshleyDePottey</dc:creator>
      <dc:date>2014-11-07T14:44:42Z</dc:date>
    </item>
  </channel>
</rss>

