tomasfabian / ksqlDB.RestApi.Client-DotNet

ksqlDb.RestApi.Client is a C# LINQ-enabled client API for issuing and consuming ksqlDB push and pull queries and executing statements.
MIT License
93 stars 24 forks source link

Allow select statements with EndpointType.Query #20

Closed thinnesf closed 1 year ago

thinnesf commented 2 years ago

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));

tomasfabian commented 2 years ago

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