<?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 AttributeError: ArcSDESQLExecute: in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/attributeerror-arcsdesqlexecute/m-p/1012642#M59393</link>
    <description>&lt;P&gt;Greetings,&lt;/P&gt;&lt;P&gt;I am working in a locked down environment where I can't install any Python modules, so I have to rely on arcpy while working with SDE PostgresSQL.&lt;/P&gt;&lt;P&gt;I don't get any error message connecting, it doesn't return an error for&amp;nbsp;the list of tables, only returns the wildcard, not the tables.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;for tbl in tables:
      print(tbl)

## Only returns a single wildcard, not a list of tables&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I get a DBMS error "-37 DBMS Table not found" when doing select or count..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import os, sys
import arcpy
import arcgis

arcpy.env.workspace = r"D:\Users\user\Documents\ArcGIS\Projects\Databases\Databases.gdb"
sdeconn = arcpy.ArcSDESQLExecute(r"Z:\a - Connection Files\gisserver_branch.sde")

tables = ["%"]

## Logged IN
print("Logged IN")

for tbl in tables:
    print(tbl)
                                                             
sql = "select objectid from PRP_LandParcels_Ply"

sdeconn_tables=sdeconn.execute(sql)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Appreciate any pointers, to get this working.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Clive&lt;/P&gt;</description>
    <pubDate>Tue, 29 Dec 2020 14:10:27 GMT</pubDate>
    <dc:creator>CliveSwan</dc:creator>
    <dc:date>2020-12-29T14:10:27Z</dc:date>
    <item>
      <title>AttributeError: ArcSDESQLExecute:</title>
      <link>https://community.esri.com/t5/python-questions/attributeerror-arcsdesqlexecute/m-p/1012642#M59393</link>
      <description>&lt;P&gt;Greetings,&lt;/P&gt;&lt;P&gt;I am working in a locked down environment where I can't install any Python modules, so I have to rely on arcpy while working with SDE PostgresSQL.&lt;/P&gt;&lt;P&gt;I don't get any error message connecting, it doesn't return an error for&amp;nbsp;the list of tables, only returns the wildcard, not the tables.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;for tbl in tables:
      print(tbl)

## Only returns a single wildcard, not a list of tables&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I get a DBMS error "-37 DBMS Table not found" when doing select or count..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import os, sys
import arcpy
import arcgis

arcpy.env.workspace = r"D:\Users\user\Documents\ArcGIS\Projects\Databases\Databases.gdb"
sdeconn = arcpy.ArcSDESQLExecute(r"Z:\a - Connection Files\gisserver_branch.sde")

tables = ["%"]

## Logged IN
print("Logged IN")

for tbl in tables:
    print(tbl)
                                                             
sql = "select objectid from PRP_LandParcels_Ply"

sdeconn_tables=sdeconn.execute(sql)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Appreciate any pointers, to get this working.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Clive&lt;/P&gt;</description>
      <pubDate>Tue, 29 Dec 2020 14:10:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/attributeerror-arcsdesqlexecute/m-p/1012642#M59393</guid>
      <dc:creator>CliveSwan</dc:creator>
      <dc:date>2020-12-29T14:10:27Z</dc:date>
    </item>
    <item>
      <title>Re: AttributeError: ArcSDESQLExecute:</title>
      <link>https://community.esri.com/t5/python-questions/attributeerror-arcsdesqlexecute/m-p/1012646#M59394</link>
      <description>&lt;P&gt;I'm not to sure on&amp;nbsp;arcpy.ArcSDESQLExecute, but you've created a list called 'tables' which has one string in it "%" - iterating over this will return a single %, it makes little sense.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You may have to find the tables intially using the sde connection and&amp;nbsp;&amp;nbsp;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/arcpy/functions/listtables.htm" target="_blank"&gt;ListTables—ArcGIS Pro | Documentation&lt;/A&gt;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcpy

# Set the current workspace
arcpy.env.workspace = sde_connection

# Get and print a list of tables
tables = arcpy.ListTables()
for table in tables:
    print(table)&lt;/LI-CODE&gt;&lt;P&gt;'tables' will be what you use to iterate over.&lt;/P&gt;&lt;P&gt;You also need a result of executing each query, sdeconn_tables=sdeconn.execute(sql) excutes the query, but what do you want to do with the result object contained in it? I'd advise just a print statement until you get it working.&lt;/P&gt;&lt;P&gt;Also if you could explain what you're actually trying to achieve, someone much more informed than me could probably help you better.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Dec 2020 14:36:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/attributeerror-arcsdesqlexecute/m-p/1012646#M59394</guid>
      <dc:creator>DavidPike</dc:creator>
      <dc:date>2020-12-29T14:36:59Z</dc:date>
    </item>
    <item>
      <title>Re: AttributeError: ArcSDESQLExecute:</title>
      <link>https://community.esri.com/t5/python-questions/attributeerror-arcsdesqlexecute/m-p/1012676#M59395</link>
      <description>&lt;P&gt;To start simple, ensure the user defined in the&amp;nbsp;gisserver_branch.sde connection has SELECT privileges on the&amp;nbsp;PRP_LandParcels_Ply table. Second, is the table in a different schema (owner) than the user connecting? You may need to specify the schema with the table name in the sql. Like &lt;FONT face="courier new,courier"&gt;schemaName.PRP_LandParcels_Ply&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Dec 2020 16:54:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/attributeerror-arcsdesqlexecute/m-p/1012676#M59395</guid>
      <dc:creator>BlakeTerhune</dc:creator>
      <dc:date>2020-12-29T16:54:04Z</dc:date>
    </item>
  </channel>
</rss>

