Question

Query table names (feature_type) when importing database?

  • 23 September 2022
  • 6 replies
  • 5 views

Badge +14
  • Contributor
  • 120 replies

I have a Geopackage with lots of tables and would like to speed things up by only reading the needed tables for later processing. The 'Where' field only applies to table content, I want to filter on table names. I would like to use a wildcard to import layers containing a certain string.

 

Example

In a dataset all hydrographic layers might contain the string 'hydro'

I would like to use sql to only import these layers by using something similar to 'LIKE %hydro%'

 

edited by including an example

 

Edit 2: I realise I made a huge, and embarrassing, typo. The file I am working with is a geopackage, not a gml... *facepalm*


6 replies

Badge +10

Hi @aron​, Is this helpful?

image

Badge +14

Hi @aron​, Is this helpful?

image

Thanks, but not really what I was after. I would like to use a wildcard to select layers containing a certain string.

 

Example

In a dataset all hydrographic layers might contain the string 'hydro'

I would like to use sql to only import these layers by using something similar to 'LIKE %hydro%'

Badge +10

Thanks, but not really what I was after. I would like to use a wildcard to select layers containing a certain string.

 

Example

In a dataset all hydrographic layers might contain the string 'hydro'

I would like to use sql to only import these layers by using something similar to 'LIKE %hydro%'

I see. Hopefully someone more familiar with GML can step in and help. Good luck!

Badge +2

@aron​ GML is not a queryable database and doesn't support SQL. Also, XML doesn't dictate the order of records so FME generally has to read the entire dataset and then pick that apart. Here's a starting point for working with XML/GML in FME: https://community.safe.com/s/article/inspire-gml-reading-writing-and-validation-basics

If you're able to attach a sample of your data then someone might be able to give you an optimized approach to reading your GML

Badge +14

@aron​ GML is not a queryable database and doesn't support SQL. Also, XML doesn't dictate the order of records so FME generally has to read the entire dataset and then pick that apart. Here's a starting point for working with XML/GML in FME: https://community.safe.com/s/article/inspire-gml-reading-writing-and-validation-basics

If you're able to attach a sample of your data then someone might be able to give you an optimized approach to reading your GML

@Mark Stoakes​ I realise I made a huge, and embarrassing, typo. The file I am working with is a geopackage, not a gml... *facepalm* Maybe I should just start over with a new question.

Badge +2

@aron​ You have two options.

  1. When you add the reader to FME, just select the "hydro" feature types. If the next geopackage has additional 'hydro' tables, use Import Feature Types and just add them to the workflow. The Select Tables dialog allows you to filter.
  2. Use a dynamic workflow - select Single Merged Feature Type on the Add Reader dialog. This will allow you to ender a Merge Filter where you could use *hydro* or something to read only the 'hydro' tables

Reply