Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
I am not able to get schema columns names for my input component as per module name using @DiscoverSchema,Please help me with code. I have written code like below in service class .I need to write any thing in dataset class.
thanks,
venkat.
@DiscoverSchema("guessSchema")
public Schema guessSchema(@Option("dataset") final VtigercrmComponentsDataSet dataset ,final RecordBuilderFactory factory)
{
final Schema.Entry.Builder entryBuilder = factory.newEntryBuilder();
final Schema.Builder schemaBuilder = factory.newSchemaBuilder(org.talend.sdk.component.api.record.Schema.Type.RECORD);
Schema.Type type = Schema.Type.STRING;
//return (Schema) schemaBuilder.withEntry(entryBuilder.withName("name").withType(type).withNullable(false).build());
return factory.newSchemaBuilder(Schema.Type.RECORD)
.withEntry(factory.newEntryBuilder().withName("ResponseContent").withType(Schema.Type.LONG).build()).build();
}
Hi @Venkat_C ,
This guess schema will work only if your dataset is named "guessSchema", is it the case?
Hi @Venkat_C did you get it working?
My team had same problem see thread:
https://community.talend.com/t5/Component-Development/Producer-and-DiscoverScheme/m-p/149874#M339
If you got it working what TS version you work with and which API version you use to develop your components?
Thank you!
Hi @igorbeslic ,
Yah,its working perfectly '@DiscoverSchema,i have declare List instance in my dataset class as like below and written @DiscoverSchema in service class.please find below link,it will use for create schema.
https://talend.github.io/component-runtime/main/1.1.3/record-types.html
@Option
@Structure(discoverSchema = "guessTableSchema",type=Type.IN)
@Documentation(value = "List of field names to return in the response.")
private List<String> fields = new ArrayList<>();
regards,
venkat
Hi @Venkat_C thank you for your hints! Still for me documentation links are worthless. In link you provided there is no any note about:
@Option @Structure(discoverSchema = "guessTableSchema",type=Type.IN) @Documentation(value = "List of field names to return in the response.") private List<String> fields = new ArrayList<>();
Do you have your component code available at GitHub? I sound desperate, but I think it would help more than all Telned documentation links people share in this forum. Or if you can share in this thread all important parts?
I used your hints with "@Structure" annotation but it does not trigger "@DiscoverSchema" method in "@Service" class. I put Talend Studio 7.2.1 M3 in debug mode and it does not track any interaction with service class. The "Discover schema" button in TS UI triggers "@Producer" method in my mapper's source class (invoked by "org.talend.sdk.component.runtime.di.schema.TaCoKitGuessSchema#guessSchemaThroughResult(java.lang.Object)").
Are you sure schema you get in your UI really comes from service annotated method "@DiscoverSchema"?
Thank you very much!
Hi @rmannibucau my component project is here
https://github.com/igorbeslic/talend-poc
Service implementation:
Once deployed Talend Studio never invokes:
@DiscoverSchema(value = "Dataset") public Schema discoverSchema( @Option("dataset") Dataset dataset, final RecordBuilderFactory recordBuilderFactory) {
//...
}
Thank you very much!!!
UPDATE:
I debug GuessSchema:
public TaCoKitGuessSchema(final PrintStream out, final Map<String, String> configuration, final String plugin, final String family, final String componentName, final String action)
last argument, "action" passed to TaCoKitGuessSchema is null. What could be reason for it?
Hi,
someone is facing this problem with the @DiscoverSchema ?
The method in my service class is triggered and my schema is created but the button never respects the order and never returning the same order.
It's all-time random :
Any Help ?
Thank you