Select to view content in your preferred language

Filter database table (with sql) before import

920
9
12-12-2023 03:01 AM
Status: Open
Labels (1)
TorstenFay
Occasional Contributor

When importing data from a sql-database via catalog pane, one has to load all data within the specified table. When using tables with data with complex shapes and several thousands of vertexes per entry, it takes minutes to even calculate the extent. After that one can exclude data that is not needed for the specific project.

It would be better if you could use sql-query to make a selection of entries that should be recognized and loaded in the first place. 

9 Comments
AlfredBaldenweck

If using an enterprise GDB, you may want to check out Query Layers. Query layers—ArcGIS Pro | Documentation

Bud
by

As a temporary workaround, could you use a model? Use a SQL expression in the Select tool and use that as a direct input to the Import tool.

Similar to this: Apply SQL filter to data used in Export XML Workspace Document

Related: Allow selection/SQL expression for all applicable geoprocessing tools


Also, I wonder if there are any GP tools similar to Import that have a SQL Expression parameter.

KoryKramer

@TorstenFay when you say importing data via catalog pane, are you using the Feature Class to Geodatabase tool?

XML Workspace Document?

KoryKramer_0-1702824053714.png

 

 

TorstenFay

Hey, @KoryKramer, no, I just drag the database into my map.

Step 1:

11

Step 2:

22

Step 3:

33

This Step 3 can take a while. It would be nice if one could define a filter within Step 2.

AlfredBaldenweck

Wait.

Unless I'm missing something, why aren't you using a Where clause in that Query layer?

TorstenFay

Hi, @AlfredBaldenweck , you mean via Properties -> Source -> Query... but this is only possible after loading in the whole table. As far as I know...

4.png

AlfredBaldenweck

Nope, I think you have your order of operations wrong.

AlfredBaldenweck_0-1702996396293.png

AlfredBaldenweck_1-1702996517303.png

 

TorstenFay

Many thanks for the really good workaround. Obviously I was not aware of this way of importing.

So I really just need to change my workflow. Thanks!

Bud
by

@TorstenFay In the future, it might help to avoid using the word "import" in this context. Normally, importing would mean you are inserting data into a table or feature class using a geoprocessing tool. But when you add data to a map/create a query layer, you're simply viewing the data, not importing it into a table or feature class.