I've build this model to query from my database (which succeeds), then geocode the addresses with the input from my query (which fails). The error is shown below. It couldn't open the address table, so used 'Add to Display', exported the data, added it to the model, and it ran fine.
So my question is, why does the geocode addresses tool not work with the table view (FC) from my make query Layer?
Thanks,
Stuart
LOG:
Executing (Make Query Layer): MakeQueryLayer "Database Connections\Connection to DataWarehouse.sde" …..
Start Time: Wed Oct 28 11:45:00 2015
Succeeded at Wed Oct 28 11:45:00 2015 (Elapsed Time: 0.06 seconds)
Executing Geocode Addresses...
ERROR 000006: Could not open the address table.
Failed to execute (Geocode Addresses).
Failed at Wed Oct 28 11:45:01 2015 (Elapsed Time: 1.07 seconds)
What version of ArcGIS are you using?
Can you export your model out to python and then post it so I can take a look?
Sure, and thanks for looking into this.
VERSION:
ArcGIS 10.2.2.3552
PYTHON SCRIPT:
# -*- coding: utf-8 -*-
# ---------------------------------------------------------------------------
# query_geocode_model.py
# Created on: 2015-10-28 16:03:16.00000
# (generated by ArcGIS/ModelBuilder)
# Description:
# ---------------------------------------------------------------------------
# Import arcpy module
import arcpy
# Local variables:
Connection_to_DataWarehouse_sde = "Database Connections\\Connection to DataWarehouse.sde"
USA_Geocoding_Service = "C:\\ArcGIS\\Business Analyst\\US_2013\\Data\\GEOCODING DATA\\USA Geocoding Service"
FC = "FC"
FC_updated = "C:\\VIP Maps\\Current Maps\\Financial_Centers.gdb\\FC_updated"
# Process: Make Query Layer
arcpy.MakeQueryLayer_management(Connection_to_DataWarehouse_sde, "FC", "SELECT RBr.* , location.addr1line as Address , location.city as City , location.statecd as State , location.zip as Zip FROM CFDAILYVM.reportbranch as RBr JOIN CFDAILYVM.location ON RBr.locationid = location.locationid WHERE 1 =1 AND RBr.FCActiveIn = 1 AND RBr.FCCloseDt IS NULL AND RBr.VersEndDTTM IS NULL ", "RptBranchNr", "", "", "")
# Process: Geocode Addresses
arcpy.GeocodeAddresses_geocoding(FC, USA_Geocoding_Service, "Address <None> VISIBLE NONE;City <None> VISIBLE NONE;State <None> VISIBLE NONE;ZIP <None> VISIBLE NONE", FC_updated, "STATIC")
Found a fix over here:
Create Query Layer Tool Output Object Not Found or Recognized
this arcpy.mapping.TableView from the link did the trick:
t = arcpy.mapping.TableView(test[0])
arcpy.TableToTable_conversion(t, workspace, "hz002")