Closed KovtunV closed 1 year ago
Hi @KovtunV ,
I added support for JsonPropertyNameAttribute
s during Stream or Table generation.
Could you verify it with the release candidate 2.2.0-rc.1 I've just published, please?
Regards Tomas.
@tomasfabian thank you! It works
@tomasfabian Hi, I got an error on select
SELECT column 'DATATIMESTAMP' cannot be resolved.
c# class is
public sealed class TestModel
{
[JsonPropertyName("data_timestamp")]
public string DataTimestamp { get; set; }
}
request is
context.CreateQueryStream<TestModel>("tests")
.Select(x => x.DataTimestamp)
.Subscribe(x =>
{
},
error => Console.WriteLine($"Exception: {error.Message}"),
() => Console.WriteLine("Completed"));
Hi @KovtunV,
I published a new version ksqlDB.RestApi.Client 2.2.1 which adds support to use JsonPropertyAttribute
for selects.
Hi @tomasfabian, but that doesn't work for join
Hi @KovtunV, could you provide an example, please?
Do you mean in the ON
part?
ON a.DataId = b.DataId;
@tomasfabian apparently in select part, moreover it generates strange query:
var stream = context
.CreateQueryStream<EventModel>(EndusersStreamName)
.Join(Source.Of<EventModel>(BankingTransactionsStreamName).Within(Duration.OfDays(1)),
endusers => K.Functions.ExtractJsonField(endusers.Data, "$.customer_id"),
transactions => K.Functions.ExtractJsonField(transactions.Data, "$.customer_id"),
(endusers, transactions) => new
{
EnduserId = endusers.DataId,
TransactionsId = transactions.DataId,
CustomerId = K.Functions.ExtractJsonField(endusers.Data, "$.customer_id"),
EndusersData = endusers.Data,
TransactionsData = transactions.Data
});
DataId field with attribute [JsonPropertyName("data_id")]
SELECT endusers.DataId AS EnduserId, transactions.DataId AS TransactionsId, EXTRACTJSONFIELD(endusers.data, '$.customer_id') CustomerId, endusers.Data AS EndusersData, transactions.Data AS TransactionsData FROM endusers_stream transactions INNER JOIN banking_transactions_stream transactions WITHIN 1 DAYS ON EXTRACTJSONFIELD(endusers.data, '$.customer_id') = EXTRACTJSONFIELD(transactions.data, '$.customer_id') EMIT CHANGES;
from alias with wrong transactions name instead of endusers and DataId isn't from attribute
Hi @KovtunV, please try out version 2.3.0-rc.3. I added support for selecting fields with the attribute within anonymous objects and aliasing for fromItems of the same type with the Join extension method.
@tomasfabian Thank you :)
Hello, is it possible to add this attribute support when describing property names?
For example,
Data in topic contains property data_id, but you generate from property name DATAID
CREATE STREAM EVENTS (DATAID STRING)
As a result I don't get data![image](https://user-images.githubusercontent.com/11136226/179999314-03fbaf7c-d372-4a47-99f1-a0555559e19f.png)
I expect: if there is JsonPropertyNameAttribute then your query will be like this
CREATE STREAM EVENTS (DATA_ID STRING)