<?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: join oracle table and polyline layer into single layer to be used for webservice to AGO in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/join-oracle-table-and-polyline-layer-into-single/m-p/211982#M16350</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can you post your error.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 07 Apr 2016 13:20:47 GMT</pubDate>
    <dc:creator>AndrewKeith3</dc:creator>
    <dc:date>2016-04-07T13:20:47Z</dc:date>
    <item>
      <title>join oracle table and polyline layer into single layer to be used for webservice to AGO</title>
      <link>https://community.esri.com/t5/python-questions/join-oracle-table-and-polyline-layer-into-single/m-p/211979#M16347</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Clerks are creating polylines representing construction project locations in a polyline layer located in a file based .gdb &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Attribute Table here is in the format &lt;/P&gt;&lt;P&gt;OBJECTID, SHAPE, PROJECTID, SHAPE_Length, etc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;With PROJECTID being the unique key.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is currently being&amp;nbsp; joined by PROJECTID&amp;nbsp; through “JOIN AND RELATES” to additional text data coming from an oracle view&amp;nbsp; SDEPCONSTR .CONSTRINFO in the format:&lt;/P&gt;&lt;P&gt;PROJECTID, PROJECTNAME, DESCRIPTION, DESIGNENGINEER, DESIGNPHONE, PLANNINGENGINEER, PLANNINGPHONE, etc. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Creating webservices with this join is raising a lot of medium errors about it being possibly slow since I’m accessing the Oracle server through the ESRI server and the join to an Oracle view is causing other strange artifacts in AGO.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to create a python script that picks up everything the clerks have entered either through editing the polyline layer on their workstation, combine the polylines with the oracle descriptor data through the join, and save it into one Feature Class that is local on the server that can be used to create the webservice for AGO, and just run the script as a cron job so I don’t have to do this by hand anymore.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I’m already hitting a problem with arcpy.CopyFeatures_management() only writing to a **new** Feature Class. So I have to delete the target FeatureClass each time before copying? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So far my code looks like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;# ---------------&lt;/P&gt;&lt;P&gt;# Import arcpy module&lt;/P&gt;&lt;P&gt;import arcpy&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;# Local variables:&lt;/P&gt;&lt;P&gt;ActiveProjectsInField = "Z:\\APF.gdb\\ConstructionProjects\\ActiveProjectsInField"&lt;/P&gt;&lt;P&gt;SDEPUSER_FieldProjectsCopy = "Database Connections\\ArcSDE4.sde\\SDEPCONSTR.RPP\\SDEPCONSTR.ProjectCopy"&lt;/P&gt;&lt;P&gt;data_type = ""&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;# Process: Delete temporary geodatabase&lt;/P&gt;&lt;OL style="list-style-type: lower-alpha;"&gt;&lt;LI&gt;arcpy.Delete_management(SDEPUSER_FieldProjectsCopy, data_type)&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;# Process: Copy Features to a temporary geodatabase FieldProjectsCopy&lt;/P&gt;&lt;OL style="list-style-type: lower-alpha;"&gt;&lt;LI&gt;arcpy.CopyFeatures_management(ActiveProjectsInField, SDEPUSER_FieldProjectsCopy, "", "0", "0", "0")&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;# ----------------&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Which is copying the polyline layer from the file based geodatabase into the server’s geodatabase as a new layer "ProjectCopy". But not sure how to access from within Python the additional fields needed for the Oracle data to be joined to the polylines. And should I be dropping this built table each time instead of just truncating it?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Am I on the right path, or is there a better practice for combining desktop editing of polylines with oracle data into a single feature to be exported as a webservice for display on AGO?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 Apr 2016 22:00:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/join-oracle-table-and-polyline-layer-into-single/m-p/211979#M16347</guid>
      <dc:creator>GeorgeMcQuary</dc:creator>
      <dc:date>2016-04-05T22:00:31Z</dc:date>
    </item>
    <item>
      <title>Re: join oracle table and polyline layer into single layer to be used for webservice to AGO</title>
      <link>https://community.esri.com/t5/python-questions/join-oracle-table-and-polyline-layer-into-single/m-p/211980#M16348</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I would recommend a spatial view in Oracle.&amp;nbsp; Once you get your data populated in the Oracle database, you can create another view that combines the data from the existing Oracle view and the data being copied to Oracle from the local File Geodatabase.&amp;nbsp; You can create this in ArcCatalog by right clicking on your Oracle database connection, click New, then click View.&amp;nbsp; Then you can type a SQL statement to join the view and table into a new view.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;example:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;select * from oracleview_name&lt;/P&gt;&lt;P&gt;inner join gdb_table_name_in_oracle b&lt;/P&gt;&lt;P&gt;on&lt;/P&gt;&lt;P&gt;b.projectid = a.projectid&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can replace the * with the field names you want to show in the new view.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As far as your process to get the data from FGDB to Oracle, you could use the Truncate and Append tools in python rather than Delete, Copy&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Apr 2016 20:02:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/join-oracle-table-and-polyline-layer-into-single/m-p/211980#M16348</guid>
      <dc:creator>AndrewKeith3</dc:creator>
      <dc:date>2016-04-06T20:02:17Z</dc:date>
    </item>
    <item>
      <title>Re: join oracle table and polyline layer into single layer to be used for webservice to AGO</title>
      <link>https://community.esri.com/t5/python-questions/join-oracle-table-and-polyline-layer-into-single/m-p/211981#M16349</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm finding I can create a join between the polyline layer and oracle table in modelbuilder, but when I try to do the same thing with exported python code, it fails.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;# ---------------&lt;/P&gt;&lt;P&gt;# Import arcpy module&lt;/P&gt;&lt;P&gt;import arcpy&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;# Variables (really, constants)&lt;/P&gt;&lt;P&gt;# ------------&lt;/P&gt;&lt;P&gt;# Clerks' version&lt;/P&gt;&lt;P&gt;ActiveProjectsInField = "Z:\\APF.gdb\\ConstructionProjects\\ActiveProjectsInField"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;# Copy of the Clerk's data in the main geodatabase that we can drop and rebuild.&lt;/P&gt;&lt;P&gt;SDEPUSER_FieldProjectsCopy = "Database Connections\\ArcSDE4.sde\\SDEPCONSTR.RPP\\SDEPCONSTR.ProjectCopy"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#Oracle table from other part of agency with details to display on AGO.&lt;/P&gt;&lt;P&gt;SDEPUSER_ConstrOracle = "Database Connections\\ArcSDE4.sde\\SDEPUSER.CONSTRINFO"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#Final version used to create the webservice to AGO.&lt;/P&gt;&lt;P&gt;SDEPUSER_ConstrAGO =&amp;nbsp; "Database Connections\\ArcSDE4.sde\SDEPCONSTR.RPP\\SDEPCONSTR.CONSTRAGO"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;# Code&lt;/P&gt;&lt;P&gt;#------------&lt;/P&gt;&lt;P&gt;# Process: Delete temporary geodatabase from last use.&lt;/P&gt;&lt;P&gt;arcpy.Delete_management(SDEPUSER_FieldProjectsCopy, data_type)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;# Process: Copy Clerk data to temporary geodatabase FieldProjectsCopy&lt;/P&gt;&lt;P&gt;arcpy.CopyFeatures_management(ActiveProjectsInField, SDEPUSER_FieldProjectsCopy, "", "0", "0", "0")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;# Process: Add Spatial Index to temporary table "FieldProjectsCopy" to stop "no index" warning.&lt;/P&gt;&lt;P&gt;arcpy.AddSpatialIndex_management(SDEPUSER_FieldProjectsCopy, "0", "0", "0")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;# Process: Join Field --Join the two tables. **FAILS HERE**&lt;/P&gt;&lt;P&gt;arcpy.AddJoin_management(SDEPUSER_FieldProjectsCopy, "PROJECTID", SDEPUSER_ConstrOracle, "PROJECTID", "KEEP_ALL")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;# Process: Copy all this (with joins) to a "SDEPUSER_ConstrAGO" to be used to build the webservice.&lt;/P&gt;&lt;P&gt;rcpy.CopyFeatures_management(SDEPUSER_FieldProjectsCopy, SDEPUSER_ConstrAGO, "", "0", "0", "0")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;# ----------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Apr 2016 01:17:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/join-oracle-table-and-polyline-layer-into-single/m-p/211981#M16349</guid>
      <dc:creator>GeorgeMcQuary</dc:creator>
      <dc:date>2016-04-07T01:17:37Z</dc:date>
    </item>
    <item>
      <title>Re: join oracle table and polyline layer into single layer to be used for webservice to AGO</title>
      <link>https://community.esri.com/t5/python-questions/join-oracle-table-and-polyline-layer-into-single/m-p/211982#M16350</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can you post your error.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Apr 2016 13:20:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/join-oracle-table-and-polyline-layer-into-single/m-p/211982#M16350</guid>
      <dc:creator>AndrewKeith3</dc:creator>
      <dc:date>2016-04-07T13:20:47Z</dc:date>
    </item>
    <item>
      <title>Re: join oracle table and polyline layer into single layer to be used for webservice to AGO</title>
      <link>https://community.esri.com/t5/python-questions/join-oracle-table-and-polyline-layer-into-single/m-p/211983#M16351</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Traceback (most recent call last):&lt;/P&gt;&lt;P&gt;&amp;nbsp; File "C:\Users\geouser\Desktop\JoinToOracle.py", line 34, in &amp;lt;module&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddJoin_management(SDEPUSER_FieldProjectsCopy, "PROJECTID", SDEPUSER_ConstrOracle, "PROJECTID", "KEEP_ALL")&lt;/P&gt;&lt;P&gt;&amp;nbsp; File "C:\Program Files (x86)\ArcGIS\Desktop10.2\arcpy\arcpy\management.py", line 5632, in AddJoin&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; raise e&lt;/P&gt;&lt;P&gt;ExecuteError: Failed to execute. Parameters are not valid.&lt;/P&gt;&lt;P&gt;The value cannot be a feature class&lt;/P&gt;&lt;P&gt;ERROR 000840: The value is not a Raster Layer.&lt;/P&gt;&lt;P&gt;ERROR 000840: The value is not a Raster Catalog Layer.&lt;/P&gt;&lt;P&gt;ERROR 000840: The value is not a Mosaic Layer.&lt;/P&gt;&lt;P&gt;WARNING 000970: The join field PROJECTID in the join table SDEPUSER.ProjectCopy is not indexed. To improve performance, we recommend that an index be created for the join field in the join table.&lt;/P&gt;&lt;P&gt;Failed to execute (AddJoin).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Apr 2016 18:15:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/join-oracle-table-and-polyline-layer-into-single/m-p/211983#M16351</guid>
      <dc:creator>GeorgeMcQuary</dc:creator>
      <dc:date>2016-04-07T18:15:40Z</dc:date>
    </item>
    <item>
      <title>Re: join oracle table and polyline layer into single layer to be used for webservice to AGO</title>
      <link>https://community.esri.com/t5/python-questions/join-oracle-table-and-polyline-layer-into-single/m-p/211984#M16352</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You have to make a Feature Layer and a Table View to run the AddJoin function.&amp;nbsp; I would probably get rid of line 31 and replace it with the arcpy.AddIndex_management function on the clerks layer "PROJECTID" field.&amp;nbsp; This should work:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;# ---------------
# Import arcpy module
import arcpy

# Variables (really, constants)
# ------------
# Clerks' version
ActiveProjectsInField = "Z:\\APF.gdb\\ConstructionProjects\\ActiveProjectsInField"

# Copy of the Clerk's data in the main geodatabase that we can drop and rebuild.
SDEPUSER_FieldProjectsCopy = "Database Connections\\ArcSDE4.sde\\SDEPCONSTR.RPP\\SDEPCONSTR.ProjectCopy"

#Oracle table from other part of agency with details to display on AGO.
SDEPUSER_ConstrOracle = "Database Connections\\ArcSDE4.sde\\SDEPUSER.CONSTRINFO"

#Final version used to create the webservice to AGO.
SDEPUSER_ConstrAGO =&amp;nbsp; "Database Connections\\ArcSDE4.sde\SDEPCONSTR.RPP\\SDEPCONSTR.CONSTRAGO"


arcpy.MakeFeatureLayer_management(SDEPUSER_FieldProjectsCopy, "clerk_lyr")
arcpy.MakeTableView_management(SDEPUSER_ConstrOracle, "oracle_table")
# Code
#------------
# Process: Delete temporary geodatabase from last use.
arcpy.Delete_management(SDEPUSER_FieldProjectsCopy, data_type)

# Process: Copy Clerk data to temporary geodatabase FieldProjectsCopy
arcpy.CopyFeatures_management(ActiveProjectsInField, SDEPUSER_FieldProjectsCopy, "", "0", "0", "0")

# Process: Add Spatial Index to temporary table "FieldProjectsCopy" to stop "no index" warning.
arcpy.AddSpatialIndex_management(SDEPUSER_FieldProjectsCopy, "0", "0", "0") 


# Process: Join Field --Join the two tables. **FAILS HERE**
arcpy.AddJoin_management("clerk_lyr", "PROJECTID", "oracle_table", "PROJECTID", "KEEP_ALL")

# Process: Copy all this (with joins) to a "SDEPUSER_ConstrAGO" to be used to build the webservice.
rcpy.CopyFeatures_management(SDEPUSER_FieldProjectsCopy, SDEPUSER_ConstrAGO, "", "0", "0", "0")

# ----------------&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 10:25:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/join-oracle-table-and-polyline-layer-into-single/m-p/211984#M16352</guid>
      <dc:creator>AndrewKeith3</dc:creator>
      <dc:date>2021-12-11T10:25:21Z</dc:date>
    </item>
  </channel>
</rss>

