ksqlDB.RestApi.Client-DotNet icon indicating copy to clipboard operation
ksqlDB.RestApi.Client-DotNet copied to clipboard

Allow select statements with EndpointType.Query

Open thinnesf opened this issue 3 years ago • 1 comments

Dear Tomas, you overwrite the EndpointType.Query with EndpointType.Ksql within the constructor of the KSqlDbStatement class. Using ksql it is possible to do select queries with statements on streams and tables, which is very convenient. As I understand the documentation right that can be done only with select queries. Would you consider to adapt your code to allow that type of statement queries? Probably you can do it in a smarter way than my proposal.

Using that you can just do that to query your stream: string statement = @"SELECT * FROM reportstream";

var httpResponseMessage = restApiClient.ExecuteStatementAsync(new KSqlDbStatement(statement));

thinnesf avatar Apr 01 '22 10:04 thinnesf

Hi @thinnesf, sorry for the late response.

All statements, except those starting with SELECT, can be run on the /ksql endpoint. To run SELECT statements we have to use the /query endpoint. So that's why I also separated commands from queries. The former should be executed with KSqlDbRestApiProvider and the later with KSqlDBContext.

Is there any issue with this approach, please?

Regards Tomas

tomasfabian avatar Apr 14 '22 18:04 tomasfabian