Skip to content

[question] Make API AlterTableAddColumnsRequest more friendly to users #295

@yuqi1129

Description

@yuqi1129

"In the current AlterTableAddColumnsRequest implementation, the NewColumnTransform relies on a raw SQL expression to define new columns. This approach is not intuitive as it obscures critical metadata such as the column type, default value, and nullability constraints.

To improve the clarity and maintainability of the API, could we enhance the structure to explicitly support fields like column_name, column_type, and column_default_value? This structured approach would provide better validation at the request level and a more user-friendly experience compared to parsing a complex expression string."

public class AlterTableAddColumnsRequest {
  public static final String JSON_PROPERTY_ID = "id";
  @Nullable
  private List<String> id = new ArrayList();
  public static final String JSON_PROPERTY_NEW_COLUMNS = "new_columns";
  @Nonnull
  private List<NewColumnTransform> newColumns = new ArrayList();
}

public class NewColumnTransform {
  public static final String JSON_PROPERTY_NAME = "name";
  @Nonnull
  private String name;
  public static final String JSON_PROPERTY_EXPRESSION = "expression";
  @Nonnull
  private String expression;

  public NewColumnTransform() {
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions