<?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: Table Join/comparison between different gdbs in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/table-join-comparison-between-different-gdbs/m-p/407964#M32150</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have a hard time believing two search cursors would take longer than copying out both datasets and joining them locally. In any case, have you tried the &lt;/SPAN&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.1/index.html#//001700000004000000"&gt;Feature Compare&lt;/A&gt;&lt;SPAN&gt; tool?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 04 Feb 2013 12:08:26 GMT</pubDate>
    <dc:creator>MathewCoyle</dc:creator>
    <dc:date>2013-02-04T12:08:26Z</dc:date>
    <item>
      <title>Table Join/comparison between different gdbs</title>
      <link>https://community.esri.com/t5/python-questions/table-join-comparison-between-different-gdbs/m-p/407963#M32149</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have a process that copies data between dev and UAT. There is a need for a QA script that can confirm that the data copies across cleanly. We are primarily interested in whether the "Shape_Area" is the same between the two gdbs (including some tolerance for rounding). &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Dev is a file gdb and UAT is an enterprise gdb. The main point is that they are different gdbs. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The dev gdb and the UAT gdb have the same name. The tables to compare also have the same name as do the fields that you would join on.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;We initially used two SearchCursors which worked but was slow.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I explored the MakeQueryTable_management function but it requires the tables to be in the same workspace.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is the current approach:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;## This approach involves appending the shape_area field from ## the target dataset to a copy of the source dataset and then ## doing a comparison between the areas. The results get reported ## and the copy gets dropped. This was necessary due to a bug in ## 10.1 that prevents the deletion of the right most field&amp;nbsp; print "Importing arcpy module...\n"&amp;nbsp; import arcpy&amp;nbsp; ## Compare Feature Area print "Compare Feature Area\n"&amp;nbsp; ## Variables sourceFC = "C:\\GIS\\Source.gdb\\UA1991_NZTM" destFC = "C:\\GIS\\Dest.gdb\UA1991_NZTM" TempFC = "C:\\GIS\\Source.gdb\\TEMPFC"&amp;nbsp; ## Create a temporary table to perform the join on. print "Take a copy\n" arcpy.Copy_management(sourceFC, TempFC, "")&amp;nbsp; ## Join the temporary table to the target table print "Perform Join\n" arcpy.JoinField_management (TempFC, "UA1991", destFC, "UA1991","Shape_Area")&amp;nbsp; ## Variables fields = ["UA1991","UA1991_NAME","Shape_Area","Shape_Area_1"] whereClause = "Shape_Area &amp;lt;&amp;gt; Shape_Area_1"&amp;nbsp; ## Create a cursor object containing all records ## where the shape_area differs between datasets ## and report output to screen print "Find records that differ" notEqualCur = arcpy.da.SearchCursor(TempFC, fields, whereClause) for row in notEqualCur: &amp;nbsp;&amp;nbsp;&amp;nbsp; print "\nUA1991_NAME = " + str(row[1])&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; print "UA1991 = " + str(row[0]) &amp;nbsp;&amp;nbsp;&amp;nbsp; print "S Area = " + str(row[2]) &amp;nbsp;&amp;nbsp;&amp;nbsp; print "D Area = " + str(row[3]) &amp;nbsp;&amp;nbsp;&amp;nbsp; areaDiff = (row[2] - row[3]) &amp;nbsp;&amp;nbsp;&amp;nbsp; areaDiffPerc = areaDiff/row[2] &amp;nbsp;&amp;nbsp;&amp;nbsp; if abs(areaDiffPerc) &amp;gt; 0.0001: &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "AREA DIFFERENCE: " + str(areaDiff) &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "AREA DIFFERENCE PERCENTAGE: " + str(abs(areaDiffPerc))&amp;nbsp; ## Drop the temporary table arcpy.Delete_management(TempFC)&amp;nbsp; ## delete the cursor del notEqualCur&amp;nbsp; print "\nDone."&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm interested in a faster approach with less IO. Is it possible to do a join across gdbs without copying the fields to the source table?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 03 Feb 2013 23:27:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/table-join-comparison-between-different-gdbs/m-p/407963#M32149</guid>
      <dc:creator>EliChadwick</dc:creator>
      <dc:date>2013-02-03T23:27:53Z</dc:date>
    </item>
    <item>
      <title>Re: Table Join/comparison between different gdbs</title>
      <link>https://community.esri.com/t5/python-questions/table-join-comparison-between-different-gdbs/m-p/407964#M32150</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have a hard time believing two search cursors would take longer than copying out both datasets and joining them locally. In any case, have you tried the &lt;/SPAN&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.1/index.html#//001700000004000000"&gt;Feature Compare&lt;/A&gt;&lt;SPAN&gt; tool?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Feb 2013 12:08:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/table-join-comparison-between-different-gdbs/m-p/407964#M32150</guid>
      <dc:creator>MathewCoyle</dc:creator>
      <dc:date>2013-02-04T12:08:26Z</dc:date>
    </item>
    <item>
      <title>Re: Table Join/comparison between different gdbs</title>
      <link>https://community.esri.com/t5/python-questions/table-join-comparison-between-different-gdbs/m-p/407965#M32151</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;I have a process that copies data between dev and UAT. There is a need for a QA script that can confirm that the data copies across cleanly. We are primarily interested in whether the "Shape_Area" is the same between the two gdbs (including some tolerance for rounding). &lt;BR /&gt;&lt;BR /&gt;Dev is a file gdb and UAT is an enterprise gdb. The main point is that they are different gdbs. &lt;BR /&gt;&lt;BR /&gt;The dev gdb and the UAT gdb have the same name. The tables to compare also have the same name as do the fields that you would join on.&lt;BR /&gt;&lt;BR /&gt;We initially used two SearchCursors which worked but was slow.&lt;BR /&gt;&lt;BR /&gt;I explored the MakeQueryTable_management function but it requires the tables to be in the same workspace.&lt;BR /&gt;&lt;BR /&gt;Here is the current approach:&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;## This approach involves appending the shape_area field from
## the target dataset to a copy of the source dataset and then
## doing a comparison between the areas. The results get reported
## and the copy gets dropped. This was necessary due to a bug in
## 10.1 that prevents the deletion of the right most field

print "Importing arcpy module...\n"

import arcpy

## Compare Feature Area
print "Compare Feature Area\n"

## Variables
sourceFC = "C:\\GIS\\Source.gdb\\UA1991_NZTM"
destFC = "C:\\GIS\\Dest.gdb\UA1991_NZTM"
TempFC = "C:\\GIS\\Source.gdb\\TEMPFC"

## Create a temporary table to perform the join on.
print "Take a copy\n"
arcpy.Copy_management(sourceFC, TempFC, "")

## Join the temporary table to the target table
print "Perform Join\n"
arcpy.JoinField_management (TempFC, "UA1991", destFC, "UA1991","Shape_Area")

## Variables
fields = ["UA1991","UA1991_NAME","Shape_Area","Shape_Area_1"]
whereClause = "Shape_Area &amp;lt;&amp;gt; Shape_Area_1"

## Create a cursor object containing all records
## where the shape_area differs between datasets
## and report output to screen
print "Find records that differ"
notEqualCur = arcpy.da.SearchCursor(TempFC, fields, whereClause)
for row in notEqualCur:
&amp;nbsp;&amp;nbsp;&amp;nbsp; print "\nUA1991_NAME = " + str(row[1])&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; print "UA1991 = " + str(row[0])
&amp;nbsp;&amp;nbsp;&amp;nbsp; print "S Area = " + str(row[2])
&amp;nbsp;&amp;nbsp;&amp;nbsp; print "D Area = " + str(row[3])
&amp;nbsp;&amp;nbsp;&amp;nbsp; areaDiff = (row[2] - row[3])
&amp;nbsp;&amp;nbsp;&amp;nbsp; areaDiffPerc = areaDiff/row[2]
&amp;nbsp;&amp;nbsp;&amp;nbsp; if abs(areaDiffPerc) &amp;gt; 0.0001:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "AREA DIFFERENCE: " + str(areaDiff)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "AREA DIFFERENCE PERCENTAGE: " + str(abs(areaDiffPerc))

## Drop the temporary table
arcpy.Delete_management(TempFC)

## delete the cursor
del notEqualCur

print "\nDone."&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;I'm interested in a faster approach with less IO. Is it possible to do a join across gdbs without copying the fields to the source table?&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Don't access your feature class straight from disc . Make both of them as Feature Layer using MakeFeatureLayer_management and try running search cursor . I believe it should be much faster .&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 18:33:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/table-join-comparison-between-different-gdbs/m-p/407965#M32151</guid>
      <dc:creator>VikramS</dc:creator>
      <dc:date>2021-12-11T18:33:18Z</dc:date>
    </item>
    <item>
      <title>Re: Table Join/comparison between different gdbs</title>
      <link>https://community.esri.com/t5/python-questions/table-join-comparison-between-different-gdbs/m-p/407966#M32152</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Faster approach: Copy your FC's to the IN_MEMORY space then peform the join and querying there.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://gis.stackexchange.com/questions/31699/ways-to-speed-up-python-scripts-running-as-arcgis-tools"&gt;http://gis.stackexchange.com/questions/31699/ways-to-speed-up-python-scripts-running-as-arcgis-tools&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Feb 2013 14:27:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/table-join-comparison-between-different-gdbs/m-p/407966#M32152</guid>
      <dc:creator>JamesCrandall</dc:creator>
      <dc:date>2013-02-04T14:27:51Z</dc:date>
    </item>
    <item>
      <title>Re: Table Join/comparison between different gdbs</title>
      <link>https://community.esri.com/t5/python-questions/table-join-comparison-between-different-gdbs/m-p/407967#M32153</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;We investigated the Feature Compare function. I was under the impression that the two datasets required the same records and record count. In our case there is a chance that one or more rows may have been dropped. I understood this to mean that it was not possible to do a comparison on datasets with different row counts. That is why the search cursor approach was used. Spin around one cursor populating another cursor using a where clause = slow. I'd love to hear if there was a way to use Feature Compare on datasets with different rowcounts.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Feb 2013 23:24:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/table-join-comparison-between-different-gdbs/m-p/407967#M32153</guid>
      <dc:creator>EliChadwick</dc:creator>
      <dc:date>2013-02-04T23:24:37Z</dc:date>
    </item>
    <item>
      <title>Re: Table Join/comparison between different gdbs</title>
      <link>https://community.esri.com/t5/python-questions/table-join-comparison-between-different-gdbs/m-p/407968#M32154</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;&lt;HR /&gt;[/HR]&lt;/SPAN&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;I have a hard time believing two search cursors would take longer than copying out both datasets and joining them locally. In any case, have you tried the &lt;A href="http://resources.arcgis.com/en/help/main/10.1/index.html#//001700000004000000"&gt;Feature Compare&lt;/A&gt; tool?&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;We investigated the Feature Compare function. I was under the impression that the two datasets required the same records and record count. In our case there is a chance that one or more rows may have been dropped. I understood this to mean that it was not possible to do a comparison on datasets with different row counts. That is why the search cursor approach was used. Spin around one cursor populating another cursor using a where clause = slow. I'd love to hear if there was a way to use Feature Compare on datasets with different rowcounts.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Feb 2013 23:26:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/table-join-comparison-between-different-gdbs/m-p/407968#M32154</guid>
      <dc:creator>EliChadwick</dc:creator>
      <dc:date>2013-02-04T23:26:18Z</dc:date>
    </item>
    <item>
      <title>Re: Table Join/comparison between different gdbs</title>
      <link>https://community.esri.com/t5/python-questions/table-join-comparison-between-different-gdbs/m-p/407969#M32155</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;I have a hard time believing two search cursors would take longer than copying out both datasets and joining them locally. In any case, have you tried the &lt;A href="http://resources.arcgis.com/en/help/main/10.1/index.html#//001700000004000000"&gt;Feature Compare&lt;/A&gt; tool?&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi Mathew&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;We investigated the Feature Compare function. I was under the impression that the two datasets required the same records and record count. In our case there is a chance that one or more rows may have been dropped. I understood this to mean that it was not possible to do a comparison on datasets with different row counts. That is why the search cursor approach was used. Spin around one cursor populating another cursor using a where clause = slow. I'd love to hear if there was a way to use Feature Compare on datasets with different rowcounts.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Eli&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Feb 2013 23:36:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/table-join-comparison-between-different-gdbs/m-p/407969#M32155</guid>
      <dc:creator>EliChadwick</dc:creator>
      <dc:date>2013-02-04T23:36:05Z</dc:date>
    </item>
    <item>
      <title>Re: Table Join/comparison between different gdbs</title>
      <link>https://community.esri.com/t5/python-questions/table-join-comparison-between-different-gdbs/m-p/407970#M32156</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Faster approach: Copy your FC's to the IN_MEMORY space then peform the join and querying there..&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Don't access your feature class straight from disc . Make both of them as Feature Layer using MakeFeatureLayer_management and try running search cursor . I believe it should be much faster .&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for your responses. I will give it a go and let you know how I get on.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I tried replicating the join using the Data interoperability extension (FME) and it ran in seconds so it will be interesting to compare the results.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Feb 2013 23:42:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/table-join-comparison-between-different-gdbs/m-p/407970#M32156</guid>
      <dc:creator>EliChadwick</dc:creator>
      <dc:date>2013-02-04T23:42:51Z</dc:date>
    </item>
    <item>
      <title>Re: Table Join/comparison between different gdbs</title>
      <link>https://community.esri.com/t5/python-questions/table-join-comparison-between-different-gdbs/m-p/407971#M32157</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Hi Mathew&lt;BR /&gt;&lt;BR /&gt;We investigated the Feature Compare function. I was under the impression that the two datasets required the same records and record count. In our case there is a chance that one or more rows may have been dropped. I understood this to mean that it was not possible to do a comparison on datasets with different row counts. That is why the search cursor approach was used. Spin around one cursor populating another cursor using a where clause = slow. I'd love to hear if there was a way to use Feature Compare on datasets with different rowcounts.&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;Eli&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;It will flag the different row counts as a miscomparison but that has nothing to do with the geometry which you are comparing when you select compare geometry only. Also, it sounds like you were using nested cursors which are very slow. You want to use dictionary cursor populations and calculations.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 Feb 2013 12:22:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/table-join-comparison-between-different-gdbs/m-p/407971#M32157</guid>
      <dc:creator>MathewCoyle</dc:creator>
      <dc:date>2013-02-05T12:22:17Z</dc:date>
    </item>
  </channel>
</rss>

