Skip to content
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

[feat]: Right Click CREATE/ALTER/DROP UDTs #567

Open
millerjp opened this issue Nov 25, 2024 · 0 comments
Open

[feat]: Right Click CREATE/ALTER/DROP UDTs #567

millerjp opened this issue Nov 25, 2024 · 0 comments
Assignees
Labels
All OS All OS enhancement New feature or request right click

Comments

@millerjp
Copy link
Contributor

millerjp commented Nov 25, 2024

Description

Add functionality to create/alter/drop a UDT via right-click context menu on the tree. Also, add a new grouping under keyspaces to list UDTs.

As a database administrator, I want to create, alter and drop UDTs through a GUI interface so that I can easily manage UDTs without writing CQL manually and review the generated CQL before it gets applied.

A User-Defined Type (UDT) in Cassandra is a custom data structure that allows you to group multiple fields into a single logical unit or column. Key characteristics include:

  • Ability to attach multiple named and typed data fields to a single column
  • Can contain any valid Cassandra data type, including collections (SET, LIST, MAP) and other UDTs
  • When FROZEN, the entire UDT must be updated as a whole - individual fields cannot be updated separately
  • Useful for organizing related data together and creating more complex data structures
  • Part of the Cassandra schema and automatically propagated to all cluster nodes

Example Use Case: Instead of having separate columns for street, city, state, and zip code, you can group them into a single address UDT column, making the data model more organized and logical.
Important Consideration: While UDTs provide better data organization, they reduce flexibility since frozen UDTs must be updated as a whole rather than updating individual fields

Create UDTs

A dialog is displayed allowing users to choose their options for creating the UDT. UDTs are contextual to a keyspace, so the option to Create Keyspace should be displayed when right clicking on a keyspace. Once they have selected their options and it passes validation they review the CQL. The CQL is editable in the review stage so they can manually edit if they want.

Once the user is happy with the CQL they click an "Execute" button which sends the CQL to the enhanced console where it gets executed in a BAU fashion.

UI Mockup

[Create UDT]
------------------------
UDT Name: <insert keyspacename>.[_______]
Error msg: <validation message appears here>

Add Data Field:
<UI allowing Users to add fields>

Add UDT Data Field:
<UI allowing users to add UDTs as fields>


[Review CQL] [Cancel]
------------------------

Technical Requirements

Dialog Flow

  1. User right-clicks on a keyspace node in tree
  2. "Create UDT" option appears in context menu
  3. Clicking opens a dialog (as above)
  4. [Review CQL] button is not clickable until a valid selection has been made

UDT Name Validation

  • Must be unique under keyspace (validate against selected keyspace)
  • Allowed characters: alphanumeric and underscores
  • No spaces or special characters permitted
  • Real-time validation with error messages

Add Data Field

  • A UI to allow users to add data fields to a UDTs. These should be the standard Cassandra data types except counters. They need to provide a unique name for the field in the UDT and select the data type

Add UDT Data Field

  • A UI to allow users to add other UDT data fields to a UDTs i.e nested UDTs. These should be the existing UDTs under the keyspace. They need to provide a unique name for the field in the UDT and select the data type.

CQL Preview & Execution

  • Display generated CQL
  • Allow manual editing of generated CQL
  • Execute button to run the statement
  • Show execution results/errors

Example CQL Outputs

CREATE TYPE mykeyspace.location (
    latitude text,
    longitude text,
    accuracy text,
    address text
);

CREATE TYPE mykeyspace.person (
    name text,
    contact_no text,
    alternate_contact text
);

CREATE TYPE mykeyspace.pinpoint (
    user frozen<person>,
    location frozen<location>
);

Error Handling

  • Invalid UDT name
  • CQL execution errors in Enhanced Console

Acceptance Criteria

  1. Right-click context menu shows "Create UDT" option when clicking on keyspace
  2. Dialog appears with all specified fields
  3. Real-time validation of UDT name
  4. CQL preview shows correct statement
  5. CQL execution is sent to Enhanced Console works as expected
  6. Proper error handling and user feedback in Enhanced Console

Dependencies

  • Access to cluster metadata for keyspace and udt list
  • Access to keyspace udt list for name validation

Drop UDT

A dialog is displayed with a warning and the user can see the CQL before it gets applied. User right clicks on a UDT in the UDT list under the keyspace

If they are ok to do it then then they click an "Execute" button which sends the CQL to the enhanced console where it gets executed in a BAU fashion.

UI Mockup

[Drop UDT]
------------------------
<warning message goes here>

UDT Name: <insert keyspace name>.<insert udt name>

CQL:
DROP TYPE <insert keyspace name>;

[Execute] [Cancel]
------------------------

Warning Message


This operation is irreversible and will permanently delete the UDT and it will no longer be useable.

By executing this command, **the UDT ** will be dropped *immediately.


Technical Requirements

Dialog Flow

  1. User right-clicks on a UDT node in tree
  2. "Drop UDT" option appears in context menu
  3. Clicking opens a dialog (as above)

Acceptance Criteria

  1. Right-click context menu shows "Drop UDT" option
  2. Dialog appears with all specified fields
  3. CQL preview shows correct statement
  4. CQL execution is sent to Enhanced Console works as BAU execute
  5. Proper error handling and user feedback in Enhanced Console

Dependencies

  • None, its a very simple CQL statment generated

Example CQL Outputs

DROP TYPE keyspace_name.type_name;

Error Handling

  • CQL execution errors in Enhanced Console

Alter UDT

A dialog is displayed with a warning and the user can see the CQL before it gets applied. The dialog is prepopulated with the existing UDT settings and the user can change them to generate an ALTER keyspace CQL statement.

If they are ok to do it then then they click an "Execute" button which sends the CQL to the enhanced console where it gets executed in a BAU fashion.

UI Mockup

[Alter UDT]
------------------------
<warning message goes here>

UDT Name: <insert keyspace name>.<insert keyspace name>

Edit Data Fields:
<UX for editing data fields>

Edit UDT Data Fields:
<UX for editing data fields>

[Review CQL] [Cancel]
------------------------

Dialog Flow

  1. User right-clicks on a UDT node in tree
  2. "Alter UDT" option appears in context menu
  3. Clicking opens a dialog pre-populated with the existing settings
  4. Review CQL button is not clickable until something has been changed

UDT Name

  • This can not be edited

CQL Preview & Execution

  • Display generated CQL
  • Allow manual editing of generated CQL
  • Execute button to run the statement
  • Show execution results/errors

Example CQL Outputs

-- Add a new field
ALTER TYPE keyspace_name.type_name ADD new_field new_type;

-- Rename an existing field
ALTER TYPE keyspace_name.type_name RENAME field_name TO new_field_name;

Error Handling

  • Invalid replication factors
  • CQL execution errors

Acceptance Criteria

  1. Right-click context menu shows "Alter UDT" option when right clicking on UDT
  2. Dialog appears with all specified fields pre-populated
  3. Proper handling of replication strategy selection
  4. CQL preview shows correct statement
  5. CQL execution is sent to Enhanced Console works as expected
  6. Proper error handling and user feedback in Enhanced Console

Dependencies

  • Access to cluster metadata for keyspace and UDT list
  • Access to UDT list for name validation
@millerjp millerjp added enhancement New feature or request Needs Triage bugs which are not yet confirmed labels Nov 25, 2024
@millerjp millerjp assigned millerjp and mhmdkrmabd and unassigned millerjp Nov 25, 2024
@millerjp millerjp added All OS All OS right click and removed Needs Triage bugs which are not yet confirmed labels Nov 25, 2024
@millerjp millerjp added this to the v1.0.0-release milestone Nov 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
All OS All OS enhancement New feature or request right click
Projects
None yet
Development

No branches or pull requests

2 participants