I want to join a relationship table (same database, not in SDE) to an ArcSDE feature class to display only needed features. This has to be done multiple times according to every row (value) of an other table (same database, not in SDE too).

The first step works, but I have to make a query layer first as it looks like I can't make joins with tables not in the SDE.

I do not want to create ~500 query layers (for the joins), so I'm trying to use ModelBuilder to create the query layers (and maybe also to make the joins in the future).

The figure below shows the model that I've created so far (at the moment I don't know if this approach would generally work/do its job).

enter image description here

I want to use the value catid to perform the query in the Make Query Layer (2).

How should/could I do that?

enter image description here

Here some pseudo things:

table a; -- contains some categories 
table b; -- =m:n relationship table for "a" and "c"
feature class c;
table d_*; --contains all data from "b" related to a single category (row) of "a"

foreach row in a
 create table d_*;

In psql this would be kind of simple, but I need this done on the ArcGIS level as the join of the feature class relates on this.

I was also thinking about python, because using a programming language this would also be kind of simple -- but I have no idea about python and I thought I could avoid scripting.

  • You might want to try and tackle this in Python... I'm not really totally sure what you are trying to do. Maybe you could describe your data in a little more detail or in something like pseudo code.
    – GIS Danny
    Oct 13, 2014 at 17:41
  • 1
    Well a 'better solution' would be to use SQL and use tables that can be related via a relational database. SQL Server with native spatial data, and PostGIS of course... Oct 13, 2014 at 17:44
  • "Variable Substitution" may be needed.
    – SIslam
    Dec 29, 2014 at 14:15

1 Answer 1


I'm not sure if there's anything wrong with the text of the query itself, but, to avoid ModelBuilder freaking out on you, you'll need to set catid as a prerequisite to the Make Query Layer step.

If you set up a query or other operation in ModelBuilder that is dependent on a variable generated within the model itself, ModelBuilder will usually try to evaluate the dependent step before evaluating the value of the variable itself.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.