Skip to main content

Is it possible in a startup script to access incoming shapefiles and set a private parameter based on a shapefiles attribute?

For example, I am a reading shapefiles and at the same time I want to query a rather large database based off a unique id that the shapefiles contain. I'm currently using the SQLCreator because it seems to be the fastest database reader.

I was thinking within the startup script, I could set a private or published parameter to a shapefile attribute, then in the SQLCreator, I could have a sql statement, that has db.attname = $(newParameter).

 

Any assistance would be greatly appreciated.

 

Thank you!

Hi @david_prosack88,

This process is easily built using the Shape file reader, followed by a Featurereader transformer to read the database.

The FeatureReader can use a WHERE clause, based on the attributes from the Shape file.

Hope this helps.


If you want to read the shapefile and then execute an sql query based on an attribute in the shapefile you can pass a feature containing the attribute to trigger an sqlexecutor and build the sql query using the attribue


Hi @david_prosack88,

This process is easily built using the Shape file reader, followed by a Featurereader transformer to read the database.

The FeatureReader can use a WHERE clause, based on the attributes from the Shape file.

Hope this helps.

thanks for the suggestion! I guess my only concern is how fast it reads against a database that has millions of records. Is the speed the same compared to the SQLCreator transformer?


thanks for the suggestion! I guess my only concern is how fast it reads against a database that has millions of records. Is the speed the same compared to the SQLCreator transformer?

Using the WHERE clause, the speed should be exactly the same.

Both transformers (and the database readers) use SQL to read from the database.

The main performance issue occurs if the database table is not indexed on the attribute(s) that are used in the WHERE clause.

But that is the same for SQLCreator and FeatureReader.


Using the WHERE clause, the speed should be exactly the same.

Both transformers (and the database readers) use SQL to read from the database.

The main performance issue occurs if the database table is not indexed on the attribute(s) that are used in the WHERE clause.

But that is the same for SQLCreator and FeatureReader.

Thanks! You are right. For some reason, I thought the FeatureReader transformer was much slower than the SQLCreator transformer. Thanks for the help, it performs great!


If you want to read the shapefile and then execute an sql query based on an attribute in the shapefile you can pass a feature containing the attribute to trigger an sqlexecutor and build the sql query using the attribue

Thanks @ebygomm! Your suggestions is another great way to solve my issue. Thanks!


Reply