<?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: identifying the type of database in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/identifying-the-type-of-database/m-p/347900#M27289</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Also I would add that once you have the path to the feature class you can use the function '&lt;/SPAN&gt;&lt;A href="http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/AddFieldDelimiters/000v0000004n000000/" rel="nofollow noopener noreferrer" target="_blank"&gt;AddFieldDelimeters&lt;/A&gt;&lt;SPAN&gt;' to add the proper field delimeters for the field based on the workspace type. It will automatically know how to delimit a field in a file GDB vs. a PGDB for example.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
fc = arcpy.getParamaterAsText(0)
fieldName = arcpy.getParamaterAsText(1)
newName = arcpy.AddFieldDelimiters(fc, fieldName)
sqlExp = newName + " = 5"
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 16:22:57 GMT</pubDate>
    <dc:creator>ChrisFox3</dc:creator>
    <dc:date>2021-12-11T16:22:57Z</dc:date>
    <item>
      <title>identifying the type of database</title>
      <link>https://community.esri.com/t5/python-questions/identifying-the-type-of-database/m-p/347897#M27286</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I'm new to both Python and arcpy.&amp;nbsp; I couldn't find the answer to this in the docs or in searching the forums.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have a script that gets an input feature class.&amp;nbsp; I need to make a query on the class.&amp;nbsp; However, personal geodatabases use a different query string field name format ([FIELD]) than do all the file-based databases ("FIELD").&amp;nbsp; I could make the query string a parameter and force the user to deal with this, but for reasons too boring to go into, I'd prefer to build the query myself.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is there some way to find out what type of database you are querying given a feature class from that database?&amp;nbsp;&amp;nbsp; I saw that the Describe function for workspaces provides some information, but it does not seem to distinguish between database types.&amp;nbsp; So far, I have been unable to find a way to do this, but that could easily be because I don't know precisely where to look yet.&amp;nbsp; Any help would be appreciated.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Jun 2011 18:34:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/identifying-the-type-of-database/m-p/347897#M27286</guid>
      <dc:creator>BrianMerson</dc:creator>
      <dc:date>2011-06-02T18:34:20Z</dc:date>
    </item>
    <item>
      <title>Re: identifying the type of database</title>
      <link>https://community.esri.com/t5/python-questions/identifying-the-type-of-database/m-p/347898#M27287</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You could try using arcpy.Describe on your feature class and then use the path of that feature class.&amp;nbsp; Within the path you could look for .gdb (file geodatabase) or .mdb (personal geodatabase) and then use If...Else statements to deal with the different feature classes.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;desc = arcpy.Describe ("FeatureClass")
print desc.path&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;output- C:\data\FileGeodatabase.gdb&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I hope this helps.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Cory&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 16:22:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/identifying-the-type-of-database/m-p/347898#M27287</guid>
      <dc:creator>CoryMacNeil1</dc:creator>
      <dc:date>2021-12-11T16:22:55Z</dc:date>
    </item>
    <item>
      <title>Re: identifying the type of database</title>
      <link>https://community.esri.com/t5/python-questions/identifying-the-type-of-database/m-p/347899#M27288</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Of course.&amp;nbsp; That makes perfect sense.&amp;nbsp; For some reason I was just having a mental block on the idea of looking at the paths.&amp;nbsp; Thanks.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Jun 2011 22:08:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/identifying-the-type-of-database/m-p/347899#M27288</guid>
      <dc:creator>BrianMerson</dc:creator>
      <dc:date>2011-06-02T22:08:55Z</dc:date>
    </item>
    <item>
      <title>Re: identifying the type of database</title>
      <link>https://community.esri.com/t5/python-questions/identifying-the-type-of-database/m-p/347900#M27289</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Also I would add that once you have the path to the feature class you can use the function '&lt;/SPAN&gt;&lt;A href="http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/AddFieldDelimiters/000v0000004n000000/" rel="nofollow noopener noreferrer" target="_blank"&gt;AddFieldDelimeters&lt;/A&gt;&lt;SPAN&gt;' to add the proper field delimeters for the field based on the workspace type. It will automatically know how to delimit a field in a file GDB vs. a PGDB for example.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
fc = arcpy.getParamaterAsText(0)
fieldName = arcpy.getParamaterAsText(1)
newName = arcpy.AddFieldDelimiters(fc, fieldName)
sqlExp = newName + " = 5"
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 16:22:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/identifying-the-type-of-database/m-p/347900#M27289</guid>
      <dc:creator>ChrisFox3</dc:creator>
      <dc:date>2021-12-11T16:22:57Z</dc:date>
    </item>
    <item>
      <title>Re: identifying the type of database</title>
      <link>https://community.esri.com/t5/python-questions/identifying-the-type-of-database/m-p/347901#M27290</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Just use the "workspace type" option when you list your workspaces:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy, os

arcpy.env.workspace = os.getcwd()

for gdb in arcpy.ListWorkspaces("*","Access"):
&amp;nbsp;&amp;nbsp;&amp;nbsp; print "Access: "+gdb

for gdb in arcpy.ListWorkspaces("*","FileGDB"):
&amp;nbsp;&amp;nbsp;&amp;nbsp; print "FGDB: "+gdb&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 16:23:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/identifying-the-type-of-database/m-p/347901#M27290</guid>
      <dc:creator>RDHarles</dc:creator>
      <dc:date>2021-12-11T16:23:01Z</dc:date>
    </item>
  </channel>
</rss>

