j_angelevski
5 years agoContributor III
Add more default rows to SnapType.TABLE
Hello,
I am developing a custom snap and I would like to know if it’s possible to add more default rows to a table. For example the Mapper snap has one default row when we open it.
I want something similar to the Snowflake SCD2 snap, when we open the snap it has 4 default rows.
I’ve searched the documentation but I didn’t find anything about this particular problem.
To elaborate, you’d set the defaultValue to DEFAULT_TABLE_VALUES defined something like this:
private static final Map<String, Object> MEANING_ENTRY1 = ImmutableMap.of("value", DEFAULT_MEANING_0); private static final Map<String, Object> MEANING_ENTRY2 = ImmutableMap.of("value", DEFAULT_MEANING_1); private static final Map<String, Object> MEANING_ENTRY3 = ImmutableMap.of("value", DEFAULT_MEANING_2); private static final Map<String, Object> MEANING_ENTRY4 = ImmutableMap.of("value", DEFAULT_MEANING_3); private static final Map<String, Object> VALUE_ENTRY3 = ImmutableMap.of("expression", true, "value", DEFAULT_VALUE_2); private static final Map<String, Object> VALUE_ENTRY4 = ImmutableMap.of("expression", true, "value", DEFAULT_VALUE_2); private static final Map<String, Object> ROW1 = ImmutableMap.of("meaning", MEANING_ENTRY1); private static final Map<String, Object> ROW2 = ImmutableMap.of("meaning", MEANING_ENTRY2); private static final Map<String, Object> ROW3 = ImmutableMap.of("meaning", MEANING_ENTRY3, "value", VALUE_ENTRY3); private static final Map<String, Object> ROW4 = ImmutableMap.of("meaning", MEANING_ENTRY4, "value", VALUE_ENTRY4); private static final List<Object> DEFAULT_TABLE_VALUES = ImmutableList.of(ROW1, ROW2, ROW3, ROW4);