<?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: Setting OID Fields in Make Query Layer Function in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/setting-oid-fields-in-make-query-layer-function/m-p/537488#M42038</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;just curious, since there seems to be no standard amongst databases or programming languages, I just want to make sure the '=' means and equality check and not an assignment check?&amp;nbsp; Some environments use the more useful '==' as a test for equality and '=' when assigning values&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 03 Jun 2016 15:21:08 GMT</pubDate>
    <dc:creator>DanPatterson_Retired</dc:creator>
    <dc:date>2016-06-03T15:21:08Z</dc:date>
    <item>
      <title>Setting OID Fields in Make Query Layer Function</title>
      <link>https://community.esri.com/t5/python-questions/setting-oid-fields-in-make-query-layer-function/m-p/537485#M42035</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey all, I am trying to use the:&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;MakeQueryLayer_management &lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;funtion using arcpy in ArcGIS 10.3. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://pro.arcgis.com/en/pro-app/tool-reference/data-management/make-query-layer.htm" title="http://pro.arcgis.com/en/pro-app/tool-reference/data-management/make-query-layer.htm"&gt;Make Query Layer—Data Management toolbox | ArcGIS for Desktop&lt;/A&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am trying to set 2 fields as the OID fields (parameter #4). For the life of me, I can't get them to set in the resulting Query Layer. It will set the first one field, but not the second one. I am running this from both a python addin and from the built in python command line window in ArcMap:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="python" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_14649096442241318 jive_text_macro" data-renderedposition="356_50_798_16" jivemacro_uid="_14649096442241318" modifiedtitle="true"&gt;&lt;P&gt;arcpy.MakeQueryLayer_management (r"Database Connections\XXXX.sde", "Table_Test3", "select a.tenure_number_id, b.event_number_id from mta_acquired_tenure_svw a, mta_event c, mta_tenure_event_xref b where a.tenure_number_id = b.tenure_number_id and b.event_number_id = c.event_number_id", "TENURE_NUMBER_ID (Long Integer, Not nullable);EVENT_NUMBER_ID (Long Integer, Not nullable)")&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The fields are valid. If I were to create a Query layer via the GUI in ArcMap (i.e. File--&amp;gt;Add Data--&amp;gt;Add Query Layer...), the query layer successfully populates and both the OID fields are set because I can manually check off each layer in the second page of the dialogue box. I tried reversing the fields in the query (shot in the dark) and what I've noticed is, it will set the first field in the table as the OID, but not the second. I've tried using the table aliases in the field names. No luck. Any suggestions? thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Jun 2016 23:31:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/setting-oid-fields-in-make-query-layer-function/m-p/537485#M42035</guid>
      <dc:creator>MikeMacRae</dc:creator>
      <dc:date>2016-06-02T23:31:19Z</dc:date>
    </item>
    <item>
      <title>Re: Setting OID Fields in Make Query Layer Function</title>
      <link>https://community.esri.com/t5/python-questions/setting-oid-fields-in-make-query-layer-function/m-p/537486#M42036</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This definitely has all the signs of a bug.&amp;nbsp; I ran the Make Query Layer tool and then used "Copy as Python Snippet" from the Results window.&amp;nbsp; The code given to me does not reproduce the results of running the tool from the GUI.&amp;nbsp; I would open an Esri Support case to log a bug.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Jun 2016 13:32:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/setting-oid-fields-in-make-query-layer-function/m-p/537486#M42036</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2016-06-03T13:32:09Z</dc:date>
    </item>
    <item>
      <title>Re: Setting OID Fields in Make Query Layer Function</title>
      <link>https://community.esri.com/t5/python-questions/setting-oid-fields-in-make-query-layer-function/m-p/537487#M42037</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for taking the time to test Joshua. It seems buggy. I've played with a variety of settings and it just doesn't seem to read that parameter. I could literally put some nonsense into that parameter like so:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;arcpy.MakeQueryLayer_management (r"Database Connections\XXXX.sde", "Table_Test3", "select a.tenure_number_id, b.event_number_id from mta_acquired_tenure_svw a, mta_tenure_event_xref b, mta_event c where a.tenure_number_id = b.tenure_number_id and b.event_number_id = c.event_number_id", "&lt;STRONG&gt;This is a buggy parameter&lt;/STRONG&gt;")&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;and it will still run, but ignore that setting. Very frustrating. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Jun 2016 15:12:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/setting-oid-fields-in-make-query-layer-function/m-p/537487#M42037</guid>
      <dc:creator>MikeMacRae</dc:creator>
      <dc:date>2016-06-03T15:12:12Z</dc:date>
    </item>
    <item>
      <title>Re: Setting OID Fields in Make Query Layer Function</title>
      <link>https://community.esri.com/t5/python-questions/setting-oid-fields-in-make-query-layer-function/m-p/537488#M42038</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;just curious, since there seems to be no standard amongst databases or programming languages, I just want to make sure the '=' means and equality check and not an assignment check?&amp;nbsp; Some environments use the more useful '==' as a test for equality and '=' when assigning values&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Jun 2016 15:21:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/setting-oid-fields-in-make-query-layer-function/m-p/537488#M42038</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2016-06-03T15:21:08Z</dc:date>
    </item>
    <item>
      <title>Re: Setting OID Fields in Make Query Layer Function</title>
      <link>https://community.esri.com/t5/python-questions/setting-oid-fields-in-make-query-layer-function/m-p/537489#M42039</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey Dan, thanks for chiming in. The third parameter in the arcpy.MakeQueryLayer_management function accepts a string representation of an sql statement which doesn't use '==' to show equality. I can literally build an sql statement in Oracle developer using sql language and then copy/paste into the third parameter and wrap it in quotes. This is why I really like the query layer function. I just wish it would work as designed! &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Jun 2016 16:17:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/setting-oid-fields-in-make-query-layer-function/m-p/537489#M42039</guid>
      <dc:creator>MikeMacRae</dc:creator>
      <dc:date>2016-06-03T16:17:54Z</dc:date>
    </item>
    <item>
      <title>Re: Setting OID Fields in Make Query Layer Function</title>
      <link>https://community.esri.com/t5/python-questions/setting-oid-fields-in-make-query-layer-function/m-p/537490#M42040</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok... I never work with them, but the suggestion from the help&lt;/P&gt;&lt;P style="color: #4d4d4d; font-family: 'Lucida Grande', 'Segoe UI', Arial, sans-serif; font-size: 14px;"&gt;fields&lt;/P&gt;&lt;P class="expressionhint" style="color: #4d4d4d; font-family: 'Lucida Grande', 'Segoe UI', Arial, sans-serif; font-size: 14px;"&gt;[oid_fields,...]&lt;/P&gt;&lt;P class="paramhint" style="color: #4d4d4d; font-family: 'Lucida Grande', 'Segoe UI', Arial, sans-serif; font-size: 14px;"&gt;(Optional)&lt;/P&gt;&lt;P class="paramhint" style="color: #4d4d4d; font-family: 'Lucida Grande', 'Segoe UI', Arial, sans-serif; font-size: 14px;"&gt;shows a list of oid fields, and to me a list is in [ ] because I work with python, but I have seen situations where arctoolbox 'lists' return semi-colon delimited text strings (I have no clue why).&amp;nbsp; So they give no multi-case example in the help topic so I can't confirm if this is the normal behaviour for this tool.&amp;nbsp; So if you have gotten this to work in the past as you have shown with a different file, then all I can suggest is try to build the query starting with one, then 2 etc to see if/how it works since it may identify one situation where it doesn't.&lt;/P&gt;&lt;P class="paramhint" style="color: #4d4d4d; font-family: 'Lucida Grande', 'Segoe UI', Arial, sans-serif; font-size: 14px;"&gt;so to summarize = is ok, string enclosure is suggested as ok, leaving is a comma-separated or semi-colon 'list' representation since I doubt a [ ] would be used outside of python&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Jun 2016 16:24:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/setting-oid-fields-in-make-query-layer-function/m-p/537490#M42040</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2016-06-03T16:24:55Z</dc:date>
    </item>
    <item>
      <title>Re: Setting OID Fields in Make Query Layer Function</title>
      <link>https://community.esri.com/t5/python-questions/setting-oid-fields-in-make-query-layer-function/m-p/537491#M42041</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks again Dan. Amoung the many approaches I have tried, they include your suggestions above. I have tried a python list []. that doesn't work. Same goes with a semicolon delimited string list as in the help example. That doesn't work. In all cases, when I run the command in python, whichever field is first in the resulting table, gets set as the OID. Every other field is ignored. So, for example, if I use 2 or more fields as OID's, only the first field in the table gets set as the OID. I've also tested by setting the OID to just the second field in the table. No luck. It still sets the OID to the first field in the table. Again, the function just seems to ignore that parameter altogether....&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Jun 2016 16:33:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/setting-oid-fields-in-make-query-layer-function/m-p/537491#M42041</guid>
      <dc:creator>MikeMacRae</dc:creator>
      <dc:date>2016-06-03T16:33:56Z</dc:date>
    </item>
    <item>
      <title>Re: Setting OID Fields in Make Query Layer Function</title>
      <link>https://community.esri.com/t5/python-questions/setting-oid-fields-in-make-query-layer-function/m-p/537492#M42042</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok... you seem to have covered all the possibilities... I would suggest shipping this off to tech support for commentary, either there is an error, a documentation bug, or an 'issue' that isn't readily obvious..&amp;nbsp; Good luck and report back &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Jun 2016 16:45:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/setting-oid-fields-in-make-query-layer-function/m-p/537492#M42042</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2016-06-03T16:45:10Z</dc:date>
    </item>
    <item>
      <title>Re: Setting OID Fields in Make Query Layer Function</title>
      <link>https://community.esri.com/t5/python-questions/setting-oid-fields-in-make-query-layer-function/m-p/537493#M42043</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Any news on this?&lt;/P&gt;&lt;P&gt;&lt;A href="http://support.esri.com/en/bugs/nimbus/QlVHLTAwMDA5MDQ1Mg==" title="http://support.esri.com/en/bugs/nimbus/QlVHLTAwMDA5MDQ1Mg=="&gt;BUG-000090452: The arcpy.MakeQueryLayer_management() command does n..&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Found the same thing mentioned on stackexchange: &lt;A href="http://gis.stackexchange.com/questions/192358/cant-specify-oid-field-in-arcpy-makequerylayer-management" title="http://gis.stackexchange.com/questions/192358/cant-specify-oid-field-in-arcpy-makequerylayer-management"&gt;arcgis 10.2 - Can't specify OID field in arcpy.MakeQueryLayer_management - Geographic Information Systems Stack Exchange&lt;/A&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Jun 2016 09:43:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/setting-oid-fields-in-make-query-layer-function/m-p/537493#M42043</guid>
      <dc:creator>RyanMonk1</dc:creator>
      <dc:date>2016-06-10T09:43:20Z</dc:date>
    </item>
    <item>
      <title>Re: Setting OID Fields in Make Query Layer Function</title>
      <link>https://community.esri.com/t5/python-questions/setting-oid-fields-in-make-query-layer-function/m-p/537494#M42044</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey Ryan. I spoke to ESRI this week about it. We went through some testing and they were able to replicate the issue. It was elevated to the Enterprise team for research and a fix. Unfortunately, if a fix is made, if won't be avalaible for the next service pack in 10.4. Thanks for finding the BUG number. I didn't find that, nor did ESRI when I chatted with them. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Jun 2016 19:02:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/setting-oid-fields-in-make-query-layer-function/m-p/537494#M42044</guid>
      <dc:creator>MikeMacRae</dc:creator>
      <dc:date>2016-06-10T19:02:05Z</dc:date>
    </item>
    <item>
      <title>Re: Setting OID Fields in Make Query Layer Function</title>
      <link>https://community.esri.com/t5/python-questions/setting-oid-fields-in-make-query-layer-function/m-p/537495#M42045</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you for the update &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This bug is currently causing me trouble in ArcGIS 10.2 and Oracle 11g, I'm trying to get a python script automate the exporting of records from dynamically generated query layers.&amp;nbsp; I can't seem to get it to function exactly the same as the manual process of doing 'File / Add Data / Add Query Layer' then right click 'Export' &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/sad.png" /&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For now I just add an Oracle ROWNUM as the first column in the query to generate an OID. &amp;nbsp;To make it work I needed to cast it to a Number(10) otherwise ArcGIS thinks it is a Double and won't use it. &amp;nbsp;"select cast(rownum as number(10)) as objectid, * from ..."&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Jun 2016 03:47:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/setting-oid-fields-in-make-query-layer-function/m-p/537495#M42045</guid>
      <dc:creator>RyanMonk1</dc:creator>
      <dc:date>2016-06-14T03:47:08Z</dc:date>
    </item>
    <item>
      <title>Re: Setting OID Fields in Make Query Layer Function</title>
      <link>https://community.esri.com/t5/python-questions/setting-oid-fields-in-make-query-layer-function/m-p/537496#M42046</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It appears a fix didn't make it in 10.4.1&lt;BR /&gt;&lt;A href="http://downloads.esri.com/support/downloads/other_/10-4-1-IssuesAddressedList.pdf" title="http://downloads.esri.com/support/downloads/other_/10-4-1-IssuesAddressedList.pdf"&gt;http://downloads.esri.com/support/downloads/other_/10-4-1-IssuesAddressedList.pdf&lt;/A&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Jul 2016 19:06:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/setting-oid-fields-in-make-query-layer-function/m-p/537496#M42046</guid>
      <dc:creator>PhilLarkin1</dc:creator>
      <dc:date>2016-07-14T19:06:13Z</dc:date>
    </item>
    <item>
      <title>Re: Setting OID Fields in Make Query Layer Function</title>
      <link>https://community.esri.com/t5/python-questions/setting-oid-fields-in-make-query-layer-function/m-p/537497#M42047</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you for the &lt;STRONG&gt;rownum&lt;/STRONG&gt; work-around Ryan. I've added it to the conversation at&amp;nbsp;&lt;A class="link-titled" href="https://gis.stackexchange.com/questions/203630/converting-double-field-to-integer-in-database-view-so-arcmap-query-layer-can-us" title="https://gis.stackexchange.com/questions/203630/converting-double-field-to-integer-in-database-view-so-arcmap-query-layer-can-us"&gt;arcgis desktop - Converting double field to integer in database view so ArcMap query layer can use field as unique ident…&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Nov 2018 21:13:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/setting-oid-fields-in-make-query-layer-function/m-p/537497#M42047</guid>
      <dc:creator>MattWilkie3</dc:creator>
      <dc:date>2018-11-14T21:13:28Z</dc:date>
    </item>
  </channel>
</rss>

