<?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 Get FGDB database view's SQL definition using Python in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/get-fgdb-database-view-s-sql-definition-using/m-p/1288277#M67626</link>
    <description>&lt;P&gt;&lt;EM&gt;ArcGIS Pro 3.1.1&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;Is there a way to get a&amp;nbsp;FGDB database view's SQL definition using Python?&lt;/P&gt;&lt;P&gt;For example, I have a file geodatabase database view called TEST_TABLE&lt;STRONG&gt;_VW&lt;/STRONG&gt;:&lt;/P&gt;&lt;PRE&gt;select objectid, case when type = 'NT' then 1 else 0 end as flag from test_table &lt;/PRE&gt;&lt;P&gt;Is there a way to assign that SQL text to a Python variable, print it, etc.?&lt;/P&gt;</description>
    <pubDate>Thu, 11 May 2023 17:28:57 GMT</pubDate>
    <dc:creator>Bud</dc:creator>
    <dc:date>2023-05-11T17:28:57Z</dc:date>
    <item>
      <title>Get FGDB database view's SQL definition using Python</title>
      <link>https://community.esri.com/t5/python-questions/get-fgdb-database-view-s-sql-definition-using/m-p/1288277#M67626</link>
      <description>&lt;P&gt;&lt;EM&gt;ArcGIS Pro 3.1.1&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;Is there a way to get a&amp;nbsp;FGDB database view's SQL definition using Python?&lt;/P&gt;&lt;P&gt;For example, I have a file geodatabase database view called TEST_TABLE&lt;STRONG&gt;_VW&lt;/STRONG&gt;:&lt;/P&gt;&lt;PRE&gt;select objectid, case when type = 'NT' then 1 else 0 end as flag from test_table &lt;/PRE&gt;&lt;P&gt;Is there a way to assign that SQL text to a Python variable, print it, etc.?&lt;/P&gt;</description>
      <pubDate>Thu, 11 May 2023 17:28:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/get-fgdb-database-view-s-sql-definition-using/m-p/1288277#M67626</guid>
      <dc:creator>Bud</dc:creator>
      <dc:date>2023-05-11T17:28:57Z</dc:date>
    </item>
    <item>
      <title>Re: Get FGDB database view's SQL definition using Python</title>
      <link>https://community.esri.com/t5/python-questions/get-fgdb-database-view-s-sql-definition-using/m-p/1288292#M67627</link>
      <description>&lt;P&gt;The describe object for tables has a "whereClause" property. That should do it.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcpy

# Create a table view from a feature class
if arcpy.Exists("view"):
    arcpy.Delete_management("view")
arcpy.management.MakeTableView(
    in_table="a",
    out_view="view",
    where_clause="OID = 0",
)

# Create a Describe object from the table view
desc = arcpy.Describe("view")

# Print some table view properties
print(f"Table View Name: {desc.nameString}")
print(f"Where Clause:    {desc.whereClause}")
print(f"Table Name:      {desc.name}")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 11 May 2023 17:59:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/get-fgdb-database-view-s-sql-definition-using/m-p/1288292#M67627</guid>
      <dc:creator>DannyMcVey</dc:creator>
      <dc:date>2023-05-11T17:59:33Z</dc:date>
    </item>
  </channel>
</rss>

