Closed HaroonSaid closed 2 years ago
Thanks for the guidance.
Hi @HaroonSaid, C# version of Create type is not supported (implemented) in the current version.
Did you want to do something similar?
await restApiClient.CreateTableAsync<ElasticSearchEvent>(metadata);
Could you also provide the KSQL you used in the CLI mentioned above?
see also supported data types in selects
In selects try to use C# arrays instead of IEnumerable<T>
A KSQL fragment create fragment
CREATE TYPE EventCategories AS STRUCT<id INTEGER, name VARCHAR, description VARCHAR>;
CREATE TABLE IF NOT EXISTS "enrichedevents" (
key VARCHAR PRIMARY KEY,
id VARCHAR,
...
eventCategories ARRAY<EventCategories>)
WITH (KAFKA_TOPIC='enrichedevents', PARTITIONS=1, VALUE_FORMAT='JSON');
I will try to prioritize this requirement, at the moment you can execute any arbitrary string statements from C# in the following manner:
using Kafka.DotNet.ksqlDB.KSql.RestApi;
using Kafka.DotNet.ksqlDB.KSql.RestApi.Statements;
internal async Task ExecuteStatementAsync()
{
var ksqlDbUrl = @"http:\\localhost:8088";
var httpClientFactory = new HttpClientFactory(new Uri(ksqlDbUrl));
IKSqlDbRestApiClient restApiClient = new KSqlDbRestApiClient(httpClientFactory);
var statement = @"CREATE TYPE EventCategories AS STRUCT<id INTEGER, name VARCHAR, description VARCHAR>;";
KSqlDbStatement ksqlDbStatement = new(statement);
var httpResponseMessage = await restApiClient.ExecuteStatementAsync(ksqlDbStatement);
}
hi @HaroonSaid, could you please try out the above requested feature?
Install-Package Kafka.DotNet.ksqlDB -Version 1.6.0-rc.1
var httpResponseMessage = await restApiClient.CreateTypeAsync<EventCategory>();
I released v1.6.0
Hi Tomas
Is there a way to create a table, using a model that has arrays, my Kafka topic looks like The approach that I took, was to create a
CREATE TYPE
andCREATE TABLE
using the cli. However, it would be nice if I can do it thru the c# clientThanks