-
Notifications
You must be signed in to change notification settings - Fork 25
Generic Pull query with filters #97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hello @fsimonovskiii, Why isn’t it feasible for you to switch between different type-safe queries? context.CreatePullQuery<Category>
context.CreatePullQuery<Sport> Here’s a workaround you can try in the meantime, but you will need to handle the raw data in the response: PropertyInfo? propertyInfo = typeof(KSqlDbStatement).GetProperty("EndpointType", BindingFlags.NonPublic | BindingFlags.Instance);
propertyInfo?.SetValue(statementCategories, EndpointType.Query); |
Hello @tomasfabian Thank you for the quick reply. I like the I was just wondering if there is some easy way to achieve this that I was not seeing clearly. |
Another option would be to expose a new function for the Task<HttpResponseMessage> ExecuteQueryAsync(
KSqlDbQuery ksqlDbQuery,
CancellationToken cancellationToken = default (CancellationToken)); Or something like this (just a prototype): public class QueryResult ExecuteQueryAsync(KSqlDbQuery ksqlDbQuery, CancellationToken cancellationToken = default(CancellationToken));
public class QueryResult : HttpResponseMessage
{
public IEnumerable<Row> Rows { get; }
}
public record Row : String
{
} It would be great if you could share both your insights and your approach as well. |
Or perhaps it would be better to extend the public class QueryResult ExecutePullQueryAsync(KSqlDbQuery ksqlDbQuery, CancellationToken cancellationToken = default(CancellationToken)); |
Hey, The As for right now, I will probably up going with what you suggested: context.CreatePullQuery<Category>
context.CreatePullQuery<Sport> and make multiple strongly typed methods which should help me with the filters. |
Hi,
I have a use case where I need to reuse a
pull query
for multiple topics with different types of columns to be filtered by. My requirement is that the same call to Kafka is generic and reused for different types of data.For example I have a materialized view for
Sports
("view_sports") which contains records with valuesAnd another materialized view for
Categories
("view_categories"):I am trying to have a
pull query
which should be a single generic call to kafka, which can query data from both (or more) of these materialized views, and also be able to take corresponding filters for their respective column names.For example, to be able to query all data when needed like the following
as well as add different column name parameters as filters (for different topics):
or
So basically I would need to be able to return a List from multiple topics and be able to filter the different topics dynamically.
I have tried something like declaring different
KSqlDbStatement
and hardcoding them, while addingSessionVariables
and using a switch to change the statements, like the following:The following piece of code returns a
BadRequest
in the response object. Am I maybe sending the variable wrong?Alternatively, going with the
KSqlDbContext
object instead ofKSqlDbRestApiClient
, I saw some examples that show this is possible, however because they are strongly typed this does not fit my use case. Is there a way to define multiple column names which would be hardcoded, but ultimately return aList<object>
instead of a strongly typed object?Any help is appreciated, thanks in advance!
The text was updated successfully, but these errors were encountered: