Is there a way to get a list of exposed attributes/schema from a SQLExecutor into an attribute value or as a list? I know I can write out a record with a featurewriter and sue a schema reader to get at it, but that is a convoluted way to go. I guessing ti can be done with python, but my python skills are limited
The python to get a comma separated list of attribute names is fairly straightforward, just send one of the features to a pythoncaller with the code
def processFeature(feature):
attrNames = ','.join(feature.getAllAttributeNames())
feature.setAttribute('attrNames', attrNames)
Why not use the FeatureReader to read both Schema feature and Data features, rather than using the SQLExecutor?
Thanks, I'll try these out, I am using SQL just because it allows me to combine multiple tables together and also use subqueries to deal with a complex data source.
Thanks, I'll try these out, I am using SQL just because it allows me to combine multiple tables together and also use subqueries to deal with a complex data source.
This may not work as expected depending on database format, but at least worked fine with a PostgreSQL database in my test.
SQL Statement parameter in the first SQLExecutor (Example)
FME_SQL_DELIMITER ;
-drop view $(TEMP_VIEW);
create view $(TEMP_VIEW) as
select a.*, b.value
from table1 as a inner join table2 as b
on b.id = a.id;
Thanks all, I used the python solution, worked great, the days of typical user having any privs on the database to create stuff are long gone. In case anyone is interested, I am doing this to create a source to target column mapping, I get the column names into the flow, then run therm through an AttributeValueMapper to crosswalk them to the source table.column_name, and query the Oracle All_tab_columns table to get the column comments, so I get a source table name.column_name, target column_name and an attribute definition as a result in an xls, along with the real output in a personal geodatabase
Reply
Enter your username or e-mail address. We'll send you an e-mail with instructions to reset your password.