Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- DynamicField names from SQL value
- <dynamicField name="*_s" type="string" indexed="true" stored="true" />
- <dataConfig>
- <dataSource type="JdbcDataSource"
- driver="com.mysql.jdbc.Driver"
- url="jdbc:mysql://localhost/MY_DB"
- user="MYUSER"
- password="MYPASS"
- batchSize="-1"/>
- <document>
- <entity name="article" query="SELECT id, custom_key, custom_value FROM mytable">
- <field column="id" name="id"/>
- <field column="custom_value" name=":::WHAT TO PUT HERE?:::_s"/>
- </entity>
- </document>
- <dataConfig>
- <script><![CDATA[
- function insertVariants(row) {
- row.put(row.get('custom_key') + '_custom', row.get('custom_value'));
- return row;
- }
- ]]></script>
- <dataSource type="JdbcDataSource"
- driver="com.mysql.jdbc.Driver"
- url="jdbc:mysql://localhost/MY_DB"
- user="MYUSER"
- password="MYPASS"
- batchSize="-1"/>
- <document>
- <entity name="article" query="SELECT id, custom_key, custom_value FROM mytable" transformer="script:insertVariants">
- <field column="id" name="id"/>
- </entity>
- </document>
- </dataConfig>
Add Comment
Please, Sign In to add comment