-
Notifications
You must be signed in to change notification settings - Fork 33
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
Add support for new Flink table creation API #277
Add support for new Flink table creation API #277
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make validate-style
is failing.
Why not remove the old API?
Fails in code that is not touched. I'll add a cleanup commit.
Later PR, this is for having the support for the new API. |
2cdf74b
to
a99d7ea
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left few comments.
aiven/client/cliarg.py
Outdated
|
||
@wraps(fun) | ||
def wrapped(self): | ||
sanitized_param_name = param_name.replace("--", "").replace("-", "_") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this replace("-", "_")
needed? For example if the param name in the request is schema_sql
, is the idea here that schema-sql
gets converted into schema_sql
? Why wouldn't the caller have schema_sql
in the first place. That's the name of the parameter that can be seen in the API docs.
What I think that could be the idea is that before this PR the switch to use is --schema-sql
and thus it's kind of logical to support schema-sql
in the JSON.
But I don't this should be done, since the name of the parameter in the API is not schema-sql
.
And why replace("--", "")
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The -
to _
is replaced as it will be the name of the member in the self.args
.
The replace for --
is the same as in the user_config_json
but with different flavor as the parameter name is known there. In here the parameter name is not known and sanitazion is done programmatically.
See here:
aiven-client/aiven/client/cliarg.py
Lines 89 to 92 in a99d7ea
setattr( | |
self.args, | |
"user_config_json", | |
get_json_config(self.args.user_config_json), |
What could be done is to move the logic when calling arg
on line 50. Or change have specialized function for --table-properties
like what is done with --user-config-json
.
aiven/client/cli.py
Outdated
) | ||
@arg("-s", "--schema-sql", required=True, help="Source/Sink table schema") | ||
@arg("-s", "--schema-sql", required=False, help="Source/Sink table schema (deprecated)") | ||
@arg.json_path_or_string_parameter("--table-properties") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mo hint of the format for the JSON? Should there be - it's pretty complex.
And no client side validation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nothing apart of valid JSON check.
15f8430
to
0f6977b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
782c809
to
8bceb92
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
This is a breaking change in the sense that existing functionality is removed - "Old API". This needs to be mentioned in the release notes.
About this change: What it does, why it matters
This PR adds the support of new table creation API for Aiven for Apache Flink service.
Command line has new parameter
--table-properties
which takes a JSON string or a path to JSON file.Old API is removed.