Skip to main content
Hi,

 

 

I'm looking for a way to read all the tables which are in one schema without having to select them manually.  I have to export all the table which are stored in one particular schema in spatialite. New tables can be added end old one deleted. That's why I need something automatic...

 

 

 

Does anyone have a clue ? 

 

 

Thank's

 

 

 

Hi,

 

 

two possibilities, either dynamic schema or a combination of the reader "Schema (any format)" and a FeatureReader.

 

 

David
Still trying to find out this problem. As soon as I add a postgis reader I have to select at least one table. Selecting all table is not what I want because if I select another schema, the table structure will be different. 

 

 

Does "Dynamic schema" mean "single Merges Feature type" ? how to select only a postgis schema and not a table ?

 

 

If I chose "Schema (any format)", I can apparently add only directories or files in the dataset. How can I select the postgis database ?

 

 

Cheers 

 

 

 


Hi,

 

 

I do not know of any very simple way of doing this, you will probably have to be a bit creative.

 

 

To get a list of all the tables with a geometry column in PostGIS ("feature classes", if you will), you can use an SQLCreator with the following:

 

 

select array_to_string(array_agg(f_table_schema || '.' || f_table_name), ':') as featurelist from geometry_columns

 

This will create an attribute "featurelist" with a colon-separated list of all the tables, suitable for the FeatureReader. Hopefully you can take it from there.

 

 

David
Ok, I finally manage to do it with python script... thank's
Hi,

 

any chance you share the python script you used, i'am trying to do the same but linked as a parameter for filtering schemas without to load all the table

 

Arnaud
hi Arnaud,

 

 

Give me your email adress, I'm gonna send you the workbench.

 

 

Cheers
I realize this is a year after the fact but I had to solve this for another user and just noticed this post. Here are the steps that worked for me using the approach suggested by David R.
  1. SQLCreator transformer can get all of the PostGIS tables names with the query: select * from geometry_columns
  2. Add an AttributeExposer transformer to expose the attribute: f_table_name
  3. Add a FeatureReader transformer which can then "Query the Feature Types based on the attribute below" - use the attribute f_table_name
  4. Using the menu add a "Reader > Add Reader as Resource" to get a Workspace Resource for your PostGIS database, this is needed to provide schema for the dyanamic writer
  5. The destination feature type must be set to Dynamic so that it can write any table."Schema Sources" will be your PostGIS Workspace resource, and both "Feature Type Name" and "Schema definition come from the attribute f_table_name

Ok, I finally manage to do it with python script... thank's

Hi @uccelli!

I would be very much thankfull if i can get your script. I am trying something alike to read all the tables from sql server. Thanks in avdance.

 

Rimon

 

 

 


Reply