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. 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. Any ideas why this is happening?
csv = r'C:\temp\PostalAddress.csv'
out_workspace = r'C:\temp\temp.gdb'
# add OID field
print 'creating a copy of table with OID field'
arcpy.TableToTable_conversion(csv, 'in_memory', 'unfiltered')
addr_csv = os.path.join('in_memory', 'unfiltered')
# select only status=active and PIN <> 99*
print 'filtering table for active rows'
where = "UPPER(status) = 'ACTIVE' and PIN NOT LIKE '99%'"
arcpy.TableToTable_conversion(addr_csv, out_workspace, 'addr', where)
Thanks,
Ashley