ksqlDB.RestApi.Client-DotNet
ksqlDB.RestApi.Client-DotNet copied to clipboard
CreatePullQuery doesn't seem to respect the tablename argument
I'm not sure I'm even using the method as intended, because I don't understand the documentation, such as it is and what there is of it. It took me a while to figure out that GetAsync
changed to FirstOrDefaultAsync
for example, which is somewhere in the Readme, but the the GetAsync
is still used in a lot of code samples. Anyway, I assumed I could get away with something like this:
var result = await context
.CreatePullQuery<UserRepresentation>("latest_user_representations")
.FirstOrDefaultAsync()
Where latest_user_representations is the name of the materialized view / table I created manually on the CLI.
However, I get an error saying:
Unhandled exception. System.AggregateException: One or more errors occurred. (Exception while preparing statement: USERREPRESENTATIONS does not exist.
Statement: SELECT * FROM UserRepresentations;
Caused by: USERREPRESENTATIONS does not exist.)
Environment (please complete the following information):
- ksqldb version: v0.26.0
- "ksqlDB.RestApi.Client" Version="2.1.4"
- netcoreapp3.1
Hi @akloster, sorry I'm away from my comp this week.
The doc is ordered by release versions at the moment.
Thanks
Hi @akloster,
you are using the CreaePullQuery
method as it was intended.
I tried to reproduce your issue
var ksql = context
.CreatePullQuery<UserRepresentation>("latest_user_representations")
.ToQueryString();
But the to ToQueryString
method in my case generated a different ksql
:
SELECT * FROM latest_user_representations;
as I see in your error message:
Statement: SELECT * FROM UserRepresentations;
Now I'm wondering what makes the difference. Could you please also post how you created your context and the UserRepresentation
class, please?
Thank you!
Regards Tomas
Hi @akloster,
I added a warning to the v0.10.0
section in the Readme.md
file that GetAsync
was renamed in version 2.0.0.
I really apologize for the confusion.
I'm not able to reproduce your issue, could you give us more details, please?
Regards Tomas.
Closing due to inactivity. Issue cannot be reproduced based on the provided input.
I see something a little different, using v2.3.1.
I pass a string table name param into the CreatePullQuery
method and the query that gets generated doesnt seem to respect the value I pass in, instead, it just appends an s
.
Example: I provide MATERIALIZED_ORDER
It queries against MATERIALIZED_ORDERS
Its a rather annoying inconvenience, and kind of misleading to offer a table name parameter that doesn't actually represent the table name.
But at least I know how to work around it, seeing as I can just pass in my table name, without the trailing s, knowing the library will add it.
Hi @itzJustKranker,
you can turn off the pluralization - it is configurable with the KSqlDBContextOptions.ShouldPluralizeFromItemName
option:
using ksqlDB.RestApi.Client.KSql.Query.Context;
var contextOptions = new KSqlDBContextOptions(@"http:\\localhost:8088")
{
ShouldPluralizeFromItemName = false
};
var context = new KSqlDBContext(contextOptions);
Is it better? Setting it to false by default in newer versions would be a breaking change.
Regards Tomas