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
94 stars 25 forks source link

Source table can't be queried #87

Closed mrt181 closed 1 week ago

mrt181 commented 3 weeks ago

Describe the bug I am creating source tables and issue pull queries.

This code works fine with version 6.1.0.

After uprading to version 6.2.0 I get this error

       ksqlDB.RestApi.Client.KSql.RestApi.Exceptions.KSqlQueryException: The `Swings` table isn't queryable. To derive a queryable table, you can do 'CREATE TABLE QUERYABLE_Swings AS SELECT * FROM Swings'. See https://cnfl.io/queries for more info.
       Add EMIT CHANGES if you intended to issue a push query.
          at ksqlDB.RestApi.Client.KSql.RestApi.KSqlDbQueryStreamProvider.OnError[T](String rawJson)
          at ksqlDB.RestApi.Client.KSql.RestApi.KSqlDbQueryStreamProvider.OnLineRead[T](String rawJson)
          at ksqlDB.RestApi.Client.KSql.RestApi.KSqlDbProvider.ConsumeAsync[T](StreamReader streamReader, SemaphoreSlim semaphoreSlim, CancellationToken cancellationToken)+MoveNext()

To Reproduce I create a source table

  private async Task SetupSourceTable<T>(TopicConfig config)
  {
    var metadata = StandardMetadata(config);
    var response = await apiClient.CreateSourceTableAsync<T>(metadata, ifNotExists: true);
    await LogResponse(response, metadata);
  }

  private EntityCreationMetadata StandardMetadata(TopicConfig config)
  {
    return new EntityCreationMetadata(config.Name)
    {
      Partitions = config.Partitions,
      Replicas = config.Replicas,
      ValueFormat = SerializationFormats.Json,
      IdentifierEscaping = contextOptions.IdentifierEscaping,
      ShouldPluralizeEntityName = true,
    };
  }

and query it

      var result = context
        .CreatePullQuery<Swing>()
        .Select(s => new
        {
          s.RowTime,
          s.Asset
          s.End,
          s.Id,
          s.Start
        })
        .GetManyAsync(ct);

Expected behavior Return the values like with version 6.1.0

Environment (please complete the following information):

tomasfabian commented 3 weeks ago

Hi @mrt181, I published a hotfix.