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

Execution of pull query use a wrong table name #52

Closed draudrau closed 6 months ago

draudrau commented 6 months ago

Describe the bug Issue when using the KSqlDBContext.CreatePullQuery() function. The value given to the tableName parameter is not use as is. The table name in the underlying SQL query has an additional 'S' character. The table name doesn't follow the name gave in the KSqlDBContext.CreateOrReplaceTableStatement("TABLE_NAME") function.

To Reproduce

The SQL produce contains a wrong table name : TABLE_NAMES The execution produce an exception : ksqlDB.RestApi.Client.KSql.RestApi.Exceptions.KSqlQueryException : Exception while preparing statement: TABLE_NAMES does not exist.

Expected behavior The table name must exactly follow the given parameter in the pull query : TABLE_NAME

Environment (please complete the following information):

tomasfabian commented 6 months ago

Hello @draudrau, you have the option to configure the table name to be singular, as demonstrated below:

using ksqlDB.RestApi.Client.KSql.Linq;
using ksqlDB.RestApi.Client.KSql.Query;
using ksqlDB.RestApi.Client.KSql.Query.Context;
using ksqlDB.RestApi.Client.KSql.Query.Options;

var ksqlDbUrl = @"http://localhost:8088";

var contextOptions = new KSqlDBContextOptions(ksqlDbUrl)
{
  ShouldPluralizeFromItemName = false
};

await using var context = new KSqlDBContext(contextOptions);
draudrau commented 6 months ago

I missed this setting. Thank you for the info.