<?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: Make Query Table - Field conversion in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/make-query-table-field-conversion/m-p/327412#M25441</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;From what I understand, the data source is a non-spatial table in an Oracle database.&amp;nbsp; I am not exactly sure how to use the Feature Class to Feature Class tool in this instance as the source is simply attributes not registerd with any SDE.&amp;nbsp; Also, from the docs, &lt;A href="http://resources.arcgis.com/en/help/main/10.1/index.html#//001200000027000000"&gt;http://resources.arcgis.com/en/help/main/10.1/index.html#//001200000027000000&lt;/A&gt; the Table to Table conversion input data types does not seem have an Oracle table as an option either.&lt;BR /&gt;&lt;BR /&gt;The OP is going to have to perform some way to connect and query the data source, then create some mechanism that will transform the result to an output format desired or needed (my example shows that it will be saved as a GDB table).&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I mentioned both tools because they operate similarly to convert field types, but you are correct that in this case only the Table to Table tool was potentially an option.&amp;nbsp; Nothing of what you say about the source was explained, so my question was valid given what the user had said.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Anyway if Python does it that is nice, but only about 20 people on this forum could have come up with that solution.&amp;nbsp; (Okay, I don't know the number of people with this level of skill, but it is very small compared to the overall forum population).&amp;nbsp; In fact I am one of the people who is capable of it, but I am slow doing it.&amp;nbsp; In any case, I demand solutions from ESRI that are designed for non-programmers to do a basic operation like data conversion involving a recasting of a field.&amp;nbsp; Resorting to Python as the only option is unacceptably unfriendly from my perspective.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So long as only skilled programmers can do field conversions like this ESRI has failed its users and should be openly challenged and criticized until they can do a better job of supporting their users.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 27 Feb 2014 11:14:57 GMT</pubDate>
    <dc:creator>RichardFairhurst</dc:creator>
    <dc:date>2014-02-27T11:14:57Z</dc:date>
    <item>
      <title>Make Query Table - Field conversion</title>
      <link>https://community.esri.com/t5/python-questions/make-query-table-field-conversion/m-p/327392#M25421</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm creating a model that is sucking in data from an Oracle database, which I intend to turn into an Event Layer.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Usually this is pretty simple, however on this occation the X and Y coordinates have been stored as strings.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is it possible to convert field data types when bringing in the data with the Make Query Table tool. Clearly if I was using straight SQL to the database I could do that)?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;All help and suggestions appreciated.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Chris&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Feb 2014 14:01:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/make-query-table-field-conversion/m-p/327392#M25421</guid>
      <dc:creator>ChrisMatthews</dc:creator>
      <dc:date>2014-02-21T14:01:20Z</dc:date>
    </item>
    <item>
      <title>Re: Make Query Table - Field conversion</title>
      <link>https://community.esri.com/t5/python-questions/make-query-table-field-conversion/m-p/327393#M25422</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Are you trying to make points with the X and Y fields? Or are they simple to be used as a data field for your records?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You could use the &lt;/SPAN&gt;&lt;A href="http://help.arcgis.com/en%20/arcgisdesktop/10.0/help/index.html#//001700000047000000"&gt;Add Field tool&lt;/A&gt;&lt;SPAN&gt; to make two numeric X and Y fields and then use the &lt;/SPAN&gt;&lt;A href="http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//00170000004m000000"&gt;Calculate field tool&lt;/A&gt;&lt;SPAN&gt; to convert the string field to a number. You could probably skip the add field tool if you are confident that all the records will convert without error.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Your expression could be something like:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;float( !XField!)&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Let me know if that helps at all.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Feb 2014 13:15:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/make-query-table-field-conversion/m-p/327393#M25422</guid>
      <dc:creator>JoshuaChisholm</dc:creator>
      <dc:date>2014-02-25T13:15:21Z</dc:date>
    </item>
    <item>
      <title>Re: Make Query Table - Field conversion</title>
      <link>https://community.esri.com/t5/python-questions/make-query-table-field-conversion/m-p/327394#M25423</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Fix the database, it's that important.&amp;nbsp; I just see no value in doing gymnastics to wrestle things that should be modeled for what they are at the database tier.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If it's a date, store it as such.&amp;nbsp; Decimals, floats, integers?&amp;nbsp; Then that's what they are period.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Get with the database admin, and make it right.&amp;nbsp; You will save yourself tons of headaches, not just in the immediate, but long-term life-cycles of the tools and applications you build will be better off.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Feb 2014 13:33:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/make-query-table-field-conversion/m-p/327394#M25423</guid>
      <dc:creator>JamesCrandall</dc:creator>
      <dc:date>2014-02-25T13:33:15Z</dc:date>
    </item>
    <item>
      <title>Re: Make Query Table - Field conversion</title>
      <link>https://community.esri.com/t5/python-questions/make-query-table-field-conversion/m-p/327395#M25424</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Yes I'm going to use table to create an event layer, which is why I'm wanting to convert the field type.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I've tried using the Add Field Tool, but it throws an error on a table created with the Make Query Table tool. Although it wouldn't be my first choice to solve this problem, I ought to be possible to convert on the fly &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'll try your suggestion of converting within the Make XT Event Layer and see what happens. I'll report back here with the results.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Feb 2014 13:36:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/make-query-table-field-conversion/m-p/327395#M25424</guid>
      <dc:creator>ChrisMatthews</dc:creator>
      <dc:date>2014-02-25T13:36:20Z</dc:date>
    </item>
    <item>
      <title>Re: Make Query Table - Field conversion</title>
      <link>https://community.esri.com/t5/python-questions/make-query-table-field-conversion/m-p/327396#M25425</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Fix the database, it's that important.&amp;nbsp; I just see no value in doing gymnastics to wrestle things that should be modeled for what they are at the database tier.&lt;BR /&gt;&lt;BR /&gt;If it's a date, store it as such.&amp;nbsp; Decimals, floats, integers?&amp;nbsp; Then that's what they are period.&amp;nbsp; &lt;BR /&gt;&lt;BR /&gt;Get with the database admin, and make it right.&amp;nbsp; You will save yourself tons of headaches, not just in the immediate, but long-term life-cycles of the tools and applications you build will be better off.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Unfortunately this isn't an option as it is an third party application database. Any tampering would breach our support agreement &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Feb 2014 13:38:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/make-query-table-field-conversion/m-p/327396#M25425</guid>
      <dc:creator>ChrisMatthews</dc:creator>
      <dc:date>2014-02-25T13:38:01Z</dc:date>
    </item>
    <item>
      <title>Re: Make Query Table - Field conversion</title>
      <link>https://community.esri.com/t5/python-questions/make-query-table-field-conversion/m-p/327397#M25426</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Unfortunately this isn't an option as it is an third party application database. Any tampering would breach our support agreement &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;How exactly are you "sucking in" the Oracle data as you mentioned in your OP?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Feb 2014 13:39:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/make-query-table-field-conversion/m-p/327397#M25426</guid>
      <dc:creator>JamesCrandall</dc:creator>
      <dc:date>2014-02-25T13:39:05Z</dc:date>
    </item>
    <item>
      <title>Re: Make Query Table - Field conversion</title>
      <link>https://community.esri.com/t5/python-questions/make-query-table-field-conversion/m-p/327398#M25427</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;How exactly are you "sucking in" the Oracle data as you mentioned in your OP?&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Apologies, I should have included that info. as it is important; I'm using the Make Query Table tool.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Feb 2014 13:42:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/make-query-table-field-conversion/m-p/327398#M25427</guid>
      <dc:creator>ChrisMatthews</dc:creator>
      <dc:date>2014-02-25T13:42:24Z</dc:date>
    </item>
    <item>
      <title>Re: Make Query Table - Field conversion</title>
      <link>https://community.esri.com/t5/python-questions/make-query-table-field-conversion/m-p/327399#M25428</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Apologies, I should have included that info. as it is important; I'm using the Make Query Table tool.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;That's my bad.&amp;nbsp; Missed it.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Well... I wonder if you can perform the conversion directly in the SQL as part of the MakeQueryLayer_management implementation.&amp;nbsp; I will hunt around to see if there are examples.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My thought is, can you issue a "CAST" or "TO_NUMBER" statement in the sql somewhere?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Edit: I noticed that you are attempting to implement MakeQueryTable!&amp;nbsp; Man, that stuff just looks messy.&amp;nbsp; If it were me, I'd go towards python script and implement the cx_Oracle library --- you have so much more control.&amp;nbsp; I know that is outside of the bounds for your OP and sorry I don't have a good solution other than this.&amp;nbsp; BUT, the cx_Oracle lib is very awesome &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Feb 2014 13:46:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/make-query-table-field-conversion/m-p/327399#M25428</guid>
      <dc:creator>JamesCrandall</dc:creator>
      <dc:date>2014-02-25T13:46:22Z</dc:date>
    </item>
    <item>
      <title>Re: Make Query Table - Field conversion</title>
      <link>https://community.esri.com/t5/python-questions/make-query-table-field-conversion/m-p/327400#M25429</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Interested also how you're "sucking in" your table.&amp;nbsp; Plus this sounds like a major flaw on the DB design to store coordinates as strings.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If you need the points, and are willing to do a couple of extra steps then after you "suck in" the data, create a copy of the table (perhaps storing the copy in a FGDB).&amp;nbsp; Then add your x/y fields (type double), calculate the fields using the string type fields, then make your XY event layer.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If this is a model, and you're not allowing overwrite of geoprocessing events, simply add a step to delete the copied table before creating a new one.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I hate submitting this as a solution, so let's call it a workaround.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Feb 2014 13:49:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/make-query-table-field-conversion/m-p/327400#M25429</guid>
      <dc:creator>ChristopherBlinn1</dc:creator>
      <dc:date>2014-02-25T13:49:29Z</dc:date>
    </item>
    <item>
      <title>Re: Make Query Table - Field conversion</title>
      <link>https://community.esri.com/t5/python-questions/make-query-table-field-conversion/m-p/327401#M25430</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;That's my bad.&amp;nbsp; Missed it.&lt;BR /&gt;&lt;BR /&gt;Well... I wonder if you can perform the conversion directly in the SQL as part of the MakeQueryLayer_management implementation.&amp;nbsp; I will hunt around to see if there are examples.&lt;BR /&gt;&lt;BR /&gt;My thought is, can you issue a "CAST" or "TO_NUMBER" statement in the sql somewhere?&lt;BR /&gt;&lt;BR /&gt;Edit: I noticed that you are attempting to implement MakeQueryTable!&amp;nbsp; Man, that stuff just looks messy.&amp;nbsp; If it were me, I'd go towards python script and implement the cx_Oracle library --- you have so much more control.&amp;nbsp; I know that is outside of the bounds for your OP and sorry I don't have a good solution other than this.&amp;nbsp; BUT, the cx_Oracle lib is very awesome &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Conversion directly in the SQL would be the ideal solution, the model would be alot similiar and the load would be placed on the dB server. I will be exporting the script to Python at some point as it will be run on schedule each night, so the cx_Oracle lib is an option...&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Feb 2014 13:53:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/make-query-table-field-conversion/m-p/327401#M25430</guid>
      <dc:creator>ChrisMatthews</dc:creator>
      <dc:date>2014-02-25T13:53:25Z</dc:date>
    </item>
    <item>
      <title>Re: Make Query Table - Field conversion</title>
      <link>https://community.esri.com/t5/python-questions/make-query-table-field-conversion/m-p/327402#M25431</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Are you trying to make points with the X and Y fields? Or are they simple to be used as a data field for your records?&lt;BR /&gt;&lt;BR /&gt;You could use the &lt;A href="http://help.arcgis.com/en%20/arcgisdesktop/10.0/help/index.html#//001700000047000000"&gt;Add Field tool&lt;/A&gt; to make two numeric X and Y fields and then use the &lt;A href="http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//00170000004m000000"&gt;Calculate field tool&lt;/A&gt; to convert the string field to a number. You could probably skip the add field tool if you are confident that all the records will convert without error.&lt;BR /&gt;&lt;BR /&gt;Your expression could be something like:&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;float( !XField!)&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;Let me know if that helps at all.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I tried this from a Python version of the code. I didn't work it gave me syntax errors.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Feb 2014 14:37:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/make-query-table-field-conversion/m-p/327402#M25431</guid>
      <dc:creator>ChrisMatthews</dc:creator>
      <dc:date>2014-02-25T14:37:04Z</dc:date>
    </item>
    <item>
      <title>Re: Make Query Table - Field conversion</title>
      <link>https://community.esri.com/t5/python-questions/make-query-table-field-conversion/m-p/327403#M25432</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;I tried this from a Python version of the code. I didn't work it gave me syntax errors.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;SPAN style="font-style: italic; text-decoration: underline;"&gt;float( !XField!)&lt;/SPAN&gt;&lt;SPAN&gt; is what you have to use from the calculate field tool. If you running it right in python, try this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;float(Xstr)&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;Where &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;Xstr&lt;/SPAN&gt;&lt;SPAN&gt; is your X value as a string.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Feb 2014 14:44:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/make-query-table-field-conversion/m-p/327403#M25432</guid>
      <dc:creator>JoshuaChisholm</dc:creator>
      <dc:date>2014-02-25T14:44:36Z</dc:date>
    </item>
    <item>
      <title>Re: Make Query Table - Field conversion</title>
      <link>https://community.esri.com/t5/python-questions/make-query-table-field-conversion/m-p/327404#M25433</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;&lt;SPAN style="font-style: italic; text-decoration: underline;"&gt;float( !XField!)&lt;/SPAN&gt; is what you have to use from the calculate field tool. If you running it right in python, try this:&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;float(Xstr)&lt;/PRE&gt;&lt;BR /&gt;Where &lt;SPAN style="font-style:italic;"&gt;Xstr&lt;/SPAN&gt; is your X value as a string.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is the Python line I've tested with;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.MakeXYEventLayer_management(LLPG_Commercial_View, float("UNI72LIVE.PR_BLPU.MAP_EAST"), float("UNI72LIVE.PR_BLPU.MAP_NORTH"), LLPG_Commercial2_Layer, "", "")&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is the error returned;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ValueError: could not convert string to float: UNI72LIVE.PR_BLPU.MAP_EAST&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It looks like it is trying to convert the fieldname rather than the values in the field.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Feb 2014 07:27:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/make-query-table-field-conversion/m-p/327404#M25433</guid>
      <dc:creator>ChrisMatthews</dc:creator>
      <dc:date>2014-02-26T07:27:39Z</dc:date>
    </item>
    <item>
      <title>Re: Make Query Table - Field conversion</title>
      <link>https://community.esri.com/t5/python-questions/make-query-table-field-conversion/m-p/327405#M25434</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;ArcMap does not support casting of data fields at all except in pure SQL statements.&amp;nbsp; The tool input that are not where clauses are not SQL based.&amp;nbsp; The field is string and that is all ArcMap can use it as.&amp;nbsp; ArcMap can only create a new field that is numeric.&amp;nbsp; It cannot do anything to make your string field numeric.&amp;nbsp; This limitation has been complained about by every user for over a decade and ESRI won't take it on.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You have to convert it at the database level apart from any ESRI tools.&amp;nbsp; ESRI won't write tools to do that for you.&amp;nbsp; You are stuck either creating new fields or disconnected copies of the entire data table using Table to Table to recast the field to numeric inside of ArcMap.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;ESRI makes sure everything else results in errors.&amp;nbsp; Only a purely text based input like a cvs or txt file is converted to numeric by the tool on the fly.&amp;nbsp; If it detects that the input is a true data table it won't do that.&amp;nbsp; You would not be the first person ESRI told to suck it up and make major schema changes outside of their product to make their product work and you won't be the last.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Data conversions to make ESRI tools work feels like it is practically 50% of my job to use ArcMap at all if I have to deal with any data created outside of ArcMap by people who did not care about ESRI's data rules.&amp;nbsp; The only benefit of being forced to adhere to these strict requirements is that adhering to their rules does translate into the best performance once I make the conversions.&amp;nbsp; When ESRI attempts to accommodate such conversions on the fly the performance degradation is usually so severe I end up making the database level conversions anyway to stay sane.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In fact I won't use Excel, cvs or txt files without conversion even though they are supported, because the performance boost of using a real numeric field in a real database table is dramatic and inevitably these formats impose some use restriction that I cannot live with at some point if the data inside of them is at all valuable for my job.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Feb 2014 08:27:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/make-query-table-field-conversion/m-p/327405#M25434</guid>
      <dc:creator>RichardFairhurst</dc:creator>
      <dc:date>2014-02-26T08:27:04Z</dc:date>
    </item>
    <item>
      <title>Re: Make Query Table - Field conversion</title>
      <link>https://community.esri.com/t5/python-questions/make-query-table-field-conversion/m-p/327406#M25435</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;ArcMap does not support casting of data fields at all except in pure SQL statements.&amp;nbsp; The tool input that are not where clauses are not SQL based.&amp;nbsp; The field is string and that is all ArcMap can use it as.&amp;nbsp; ArcMap can only create a new field that is numeric.&amp;nbsp; It cannot do anything to make your string field numeric.&amp;nbsp; This limitation has been complained about by every user for over a decade and ESRI won't take it on.&lt;BR /&gt;&lt;BR /&gt;You have to convert it at the database level apart from any ESRI tools.&amp;nbsp; ESRI won't write tools to do that for you.&amp;nbsp; You are stuck either creating new fields or disconnected copies of the entire data table using Table to Table to recast the field to numeric inside of ArcMap.&lt;BR /&gt;&lt;BR /&gt;ESRI makes sure everything else results in errors.&amp;nbsp; Only a purely text based input like a cvs or txt file is converted to numeric by the tool on the fly.&amp;nbsp; If it detects that the input is a true data table it won't do that.&amp;nbsp; You would not be the first person ESRI told to suck it up and make major schema changes outside of their product to make their product work and you won't be the last.&lt;BR /&gt;&lt;BR /&gt;Data conversions to make ESRI tools work feels like it is practically 50% of my job to use ArcMap at all if I have to deal with any data created outside of ArcMap by people who did not care about ESRI's data rules.&amp;nbsp; The only benefit of being forced to adhere to these strict requirements is that adhering to their rules does translate into the best performance once I make the conversions.&amp;nbsp; When ESRI attempts to accommodate such conversions on the fly the performance degradation is usually so severe I end up making the database level conversions anyway to stay sane.&lt;BR /&gt;&lt;BR /&gt;In fact I won't use Excel, cvs or txt files without conversion even though they are supported, because the performance boost of using a real numeric field in a real database table is dramatic and inevitably these formats impose some use restriction that I cannot live with at some point if the data inside of them is at all valuable for my job.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Although it isn't the answer I wanted it at least gives me a clear answer, some times it is good to establish the limitations.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Chris&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Feb 2014 12:13:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/make-query-table-field-conversion/m-p/327406#M25435</guid>
      <dc:creator>ChrisMatthews</dc:creator>
      <dc:date>2014-02-26T12:13:43Z</dc:date>
    </item>
    <item>
      <title>Re: Make Query Table - Field conversion</title>
      <link>https://community.esri.com/t5/python-questions/make-query-table-field-conversion/m-p/327407#M25436</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Try to generate your query table then use a read cursor to iterate over the table and a write cursor to write the geometry and attributes directly to a new feature class. You can use a cast function in the python code outside of an ArcGIS tool.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Feb 2014 13:54:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/make-query-table-field-conversion/m-p/327407#M25436</guid>
      <dc:creator>BenjaminGosack</dc:creator>
      <dc:date>2014-02-26T13:54:43Z</dc:date>
    </item>
    <item>
      <title>Re: Make Query Table - Field conversion</title>
      <link>https://community.esri.com/t5/python-questions/make-query-table-field-conversion/m-p/327408#M25437</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Ideally you'd want to change the column in the database, but given your previous comments, it looks like this isn't an answer.&amp;nbsp; In that case, I'd vote for the TO_NUMBER option in your SQL statement.&amp;nbsp; The load is put on the DB server, and you're getting data in exactly the format you want inside your model.&amp;nbsp; Also, chances are the server is going to better suited to handle the extra load of changing the string into a number than your desktop is...&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Feb 2014 14:05:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/make-query-table-field-conversion/m-p/327408#M25437</guid>
      <dc:creator>RichardAsselin</dc:creator>
      <dc:date>2014-02-26T14:05:06Z</dc:date>
    </item>
    <item>
      <title>Re: Make Query Table - Field conversion</title>
      <link>https://community.esri.com/t5/python-questions/make-query-table-field-conversion/m-p/327409#M25438</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;This is one option using python script (not a model) and the cx_Oracle library.&amp;nbsp; This would allow you to put the CAST from string to numeric of your x_coord/y_coord fields in the Oracle db.&amp;nbsp; The basic idea is to fill a cursor with the results of the SQL, append those cursor rows to a new array/list, covert the list to a NumPy array and finally convert that to a FeatureClass.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This example is pulled from an implementation I have that does something similar but you will have to straighten out the SQL for your needs and it will not work if you just copy/paste, but it should get you close to what you want I think.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hope this helps!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;

import arcpy
import cx_Oracle
import numpy as np

### Build a DSN (can be subsitited for a TNS name)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
dsn = cx_Oracle.makedsn(param1, param2, param3)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
oradb = cx_Oracle.connect("username", "password", dsn)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
cursor = oradb.cursor()

sqlQry = """SELECT MyTableOrView.SomeField1 AS SomeTEXTField,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CAST(TO_CHAR(MyTableOrView.x_coords, 'fm9999999.90') AS FLOAT) AS x_coords,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CAST(TO_CHAR(MyTableOrView.y_coords, 'fm9999999.90') AS FLOAT) AS y_coords
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FROM MyTableOrView"""
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
cursor.execute(sqlQry)
datArray = []
&amp;nbsp; 
cxRows = cursor.fetchall()
for cxRow in cxRows:
&amp;nbsp;&amp;nbsp; datArray.append(cxRow)

#close the conn to ora
cursor.close() 
oradb.close()
del cxRows, cursor 

numpyarr_out = np.array(datArray, np.dtype([('SomeTEXTField', '|S25'), ('x_coords', '&amp;lt;f8'), ('y_coords', '&amp;lt;f8')]))

#convert the numpyarray to a gdb feature class
outFC = r'C:\MyGDB\xyPoints_FromStrings
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
if arcpy.Exists(outFC):
&amp;nbsp; arcpy.Delete_management(outFC)
 
arcpy.da.NumPyArrayToFeatureClass(numpyarr_out, outFC, ("x_coords", "y_coords"))

&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Even better code that elimiates the "datArray" construction as it is not needed.&amp;nbsp; Just use the cxRows list as-is!&amp;nbsp; (I need go back and update some things now -- sometimes posting on these threads makes you re-evaluate things!)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;

import arcpy
import cx_Oracle
import numpy as np

### Build a DSN (can be subsitited for a TNS name)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
dsn = cx_Oracle.makedsn(param1, param2, param3)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
oradb = cx_Oracle.connect("username", "password", dsn)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
cursor = oradb.cursor()

sqlQry = """SELECT MyTableOrView.SomeField1 AS SomeTEXTField,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CAST(TO_CHAR(MyTableOrView.x_coords, 'fm9999999.90') AS FLOAT) AS x_coords,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CAST(TO_CHAR(MyTableOrView.y_coords, 'fm9999999.90') AS FLOAT) AS y_coords
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FROM MyTableOrView"""
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
cursor.execute(sqlQry)
datArray = []
&amp;nbsp; 
cxRows = cursor.fetchall()

#close the conn to ora
cursor.close() 
oradb.close()
del cursor 

numpyarr_out = np.array(cxRows, np.dtype([('SomeTEXTField', '|S25'), ('x_coords', '&amp;lt;f8'), ('y_coords', '&amp;lt;f8')]))

#convert the numpyarray to a gdb feature class
outFC = r'C:\MyGDB\xyPoints_FromStrings
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
if arcpy.Exists(outFC):
&amp;nbsp; arcpy.Delete_management(outFC)
 
arcpy.da.NumPyArrayToFeatureClass(numpyarr_out, outFC, ("x_coords", "y_coords"))

&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 15:30:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/make-query-table-field-conversion/m-p/327409#M25438</guid>
      <dc:creator>JamesCrandall</dc:creator>
      <dc:date>2021-12-11T15:30:31Z</dc:date>
    </item>
    <item>
      <title>Re: Make Query Table - Field conversion</title>
      <link>https://community.esri.com/t5/python-questions/make-query-table-field-conversion/m-p/327410#M25439</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Why is Python needed at all to create a new feature class/table that converts the field types?&amp;nbsp; As long as you are disconnecting from the source data why not just use the Feature Class to Feature Class tool or the Table to Table tool?&amp;nbsp; They can alter the field map type of the coordinate fields from string to double and output a new FC/table and perform the desired conversion directly to the new output.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It is only if you want to use the original source and maintain a connection to it that you have to look for alternatives outside of ArcMap.&amp;nbsp; For those you need to set up the on the fly conversion on the server side.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Feb 2014 19:17:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/make-query-table-field-conversion/m-p/327410#M25439</guid>
      <dc:creator>RichardFairhurst</dc:creator>
      <dc:date>2014-02-26T19:17:48Z</dc:date>
    </item>
    <item>
      <title>Re: Make Query Table - Field conversion</title>
      <link>https://community.esri.com/t5/python-questions/make-query-table-field-conversion/m-p/327411#M25440</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Why is Python needed at all to create a new feature class/table that converts the field types?&amp;nbsp; As long as you are disconnecting from the source data why not just use the Feature Class to Feature Class tool or the Table to Table tool?&amp;nbsp; They can alter the field map type of the coordinate fields from string to double and output a new FC/table and perform the desired conversion directly to the new output.&lt;BR /&gt;&lt;BR /&gt;It is only if you want to use the original source and maintain a connection to it that you have to look for alternatives outside of ArcMap.&amp;nbsp; For those you need to set up the on the fly conversion on the server side.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;From what I understand, the data source is a non-spatial table in an Oracle database.&amp;nbsp; I am not exactly sure how to use the Feature Class to Feature Class tool in this instance as the source is simply attributes not registerd with any SDE.&amp;nbsp; Also, from the docs, &lt;/SPAN&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.1/index.html#//001200000027000000"&gt;http://resources.arcgis.com/en/help/main/10.1/index.html#//001200000027000000&lt;/A&gt;&lt;SPAN&gt; the Table to Table conversion input data types does not seem have an Oracle table as an option either.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The OP is going to have to perform some way to connect and query the data source, then create some mechanism that will transform the result to an output format desired or needed (my example shows that it will be saved as a GDB table).&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Feb 2014 10:28:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/make-query-table-field-conversion/m-p/327411#M25440</guid>
      <dc:creator>JamesCrandall</dc:creator>
      <dc:date>2014-02-27T10:28:36Z</dc:date>
    </item>
  </channel>
</rss>

