Skip to main content

We have a series of databases (postgis) that get _year_month added to their endings so that we can see which one is the newest. The rest of the name, schema etc is the same.

It would be convenient to have our workspaces automatically look for the most recent database.

So if there exists: supercooldatabase_21_09, supercooldatabase_23_07 and supercooldatabase_24_03 on the server I would like to have FME check all supercooldatabase’s and select the one with the higest number, aka _24_03. This attribute would then be passed on to guide FeatureReaders correctly.

Would it possible to do this within FME?

If it’s a file geodatabase, you can do this with the Directory and File Pathnames reader. The name of the file will be in the path_windows, with which you can use a TestFilter to get the file with the latest date. Then, pass that path_windows attribute into the FeatureReader.


Oh, I forgot. It’s a postgis database. 


Oh, I forgot. It’s a postgis database. 

One way to do this is to use a SQLCreator to get all databases with

select datname from pg_database;

and work from there. Filter the one you need. Use Embed Connection Parameters and set the database name dynamically in a SQLExecutor or a FeatureReader,


Reply