Expanded Pattern Matching in File Geodatabases (and documentation would be nice)

3290
27
12-22-2017 11:05 AM
Status: Open
Labels (1)
JoshuaBixby
MVP Esteemed Contributor

I recently ran into an issue that caused me to review the SQL reference for query expressions used in ArcGIS—Help | ArcGIS Desktop.  In the Strings section of the SQL reference I came across the following line:

Refer to the documentation of your DBMS for a list of supported functions.

 

I decided to take that advice and look up supported string functions with various DBMSs, particularly pattern matching with the SQL WHERE clause:

 

Looking at the list, one might ask, "where is the link for file geodatabases?"  My response, "exactly, where is that documentation?"  There are some pages that provide examples and speak around the issue, e.g., Building a query expression and SQL reference for query expressions used in ArcGIS, but I haven't been able to find a page that definitively and succinctly states the support like all of the other pages referenced above.

 

If one were to find the documentation (by the way, please share the link if you do), what would become clear is that file geodatabases have rudimentary support for pattern matching in strings.  The only other DBMS format, if we can call it a DBMS, with such limited support is the shape file.  Given when shape files were defined/introduced, I am willing to give a pass for them, but I can't say the same for file geodatabases.

 

The file geodatabase introduced some big improvements over the personal geodatabase when working with spatial data, but it wasn't and still isn't summarily better because it had to make some trade offs.  For all the promise that came with the original release of the file geodatabase, there has been an equal amount of disappointment over the lack of effort to continuing improving the format.

 

It is time for file geodatabases to enter the 21st Century and support regular-expression pattern matching with strings, or at least regular-expression-like functionality.

27 Comments
KoryKramer

I suppose that would be part of the documentation piece needed here.  I'll make sure to get this to the team that will be updating the documentation.

JoshuaBixby

Thanks, Kory, documentation would be most helpful.

Just to point out, neither the title nor the content of this idea ever stated "add regular expression support using LIKE," so I am not sure why the product team assumed that is what was being requested.

JoshuaBixby

I just tested on ArcGIS 10.6.x and ArcGIS Pro 2.1.x, and SIMILAR TO works.  This is great news, it is a shame Esri never documented it.  Any ideas for how long it has been supported?

JoshuaBixby

For those who find this idea and discussion and am wondering about documentation, the most descriptive and closest documentation I have found for matching observed behavior of SIMILAR TO with file geodatabases is SIMILAR TO .  It will be nice when Esri finally documents this behavior.

DougBrowning

I am testing this and SIMILAR TO does not work when using wildcards but does work otherwise.

So AG3 similar to 'AG3' works but

AG3 similar to 'AG%' does not work. (AG_ does not work either)

What I really want to do is [1-9]!

JoshuaBixby

Doug Browning‌, I got all 3 of your expressions to work (%, _, and [1-9]).

I am willing to keep troubleshooting this issue with you, I suggest you start a new question in the Geodatabase‌ space.  I

DougBrowning

Using Similar To or LIKE?

I tested the heck out of it and never got it going.  On 10.5.1 using a File Geodatabase (.GDB)

Watch

But strangely this works

And this does not

So maybe the % does not work in combo with []?

What am I missing?

Thanks

JoshuaBixby

As mentioned above, it doesn't fully work until 10.6.x.  See /blogs/tilting/2018/07/19/like-and-similar-file-geodatabases-and-pattern-matching 

DougBrowning

Found more documentation and this seems to work

TopCanopy Similar To 'AG[0-9]*'

It just does not like []%

JoshuaBixby

% is a SQL wildcard, not a regular expression wildcard, and SIMILAR TO operates on regular expression syntax.