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

[FEATURE] Support table format output for Audit command #5746

Closed
Tracked by #5747
waukin opened this issue Dec 3, 2024 · 10 comments · Fixed by #6503
Closed
Tracked by #5747

[FEATURE] Support table format output for Audit command #5746

waukin opened this issue Dec 3, 2024 · 10 comments · Fixed by #6503
Assignees
Labels
feature New feature or request

Comments

@waukin
Copy link
Contributor

waukin commented Dec 3, 2024

Describe the feature

The current Audit command in the Gravitino CLI supports only plain format output.
I plan to add support for table format output to the MetalakeAudit, CatalogAudit, SchemaAudit and TableAudit commands.

Motivation

No response

Describe the solution

No response

Additional context

No response

@waukin waukin added the feature New feature or request label Dec 3, 2024
@Abyss-lord
Copy link
Contributor

i would like to work on it. could you plz give me two tasks?

@waukin
Copy link
Contributor Author

waukin commented Feb 14, 2025

Hi @Abyss-lord, sure you can work on it.

@Abyss-lord
Copy link
Contributor

Hi @Abyss-lord, sure you can work on it.

May I have your email, I have some to discuss.

@justinmclean
Copy link
Member

It would be best to keep the conversation here, as that aligns with ASF values of openness and transparency.

@waukin
Copy link
Contributor Author

waukin commented Feb 14, 2025

Hi @Abyss-lord, sure you can work on it.

May I have your email, I have some to discuss.

Hi @Abyss-lord, We can discuss here. Or I see you are in opensource4you Slack channel, If you have something to discuss, my ID is Chia-Ying Lee. You can dm me.

@Abyss-lord
Copy link
Contributor

Hi @Abyss-lord, sure you can work on it.

May I have your email, I have some to discuss.

Hi @Abyss-lord, We can discuss here. Or I see you are in opensource4you Slack channel, If you have something to discuss, my ID is Chia-Ying Lee. You can dm me.

I have a idea that we should standardize the output handling by consolidating all output methods at the Command layer. like this

https://files.slack.com/files-pri/T05DWGA9CBT-F08D9SNQVPU/image.png

public void printInformation(String message) {
    if (context.quiet()) {
      return;
    }

    printResult(message);
  }
  

  protected <T> void printResults(T entity) {
    if (outputFormat == null) {
      PlainFormat.output(entity);
      return;
    }

    if (outputFormat.equals(OUTPUT_FORMAT_TABLE)) {
      TableFormat.output(entity);
    } else if (outputFormat.equals(OUTPUT_FORMAT_PLAIN)) {
      PlainFormat.output(entity);
    } else {
      throw new IllegalArgumentException("Unsupported output format");
    }
  }

  protected void printResults(String message) {
    PlainFormat.output(message);
  }

This way, each subclass only needs to change the getOutput method, which makes unit testing easier, like this:

Image

@waukin
Copy link
Contributor Author

waukin commented Feb 14, 2025

Hi @Abyss-lord, I cannot see the image you attached (https://files.slack.com/files-pri/T05DWGA9CBT-F08D9SNQVPU/image.png). I think I don't have permission to view the channel at Datastrato Community. Could you attach again?

@Abyss-lord
Copy link
Contributor

Hi @Abyss-lord, I cannot see the image you attached (https://files.slack.com/files-pri/T05DWGA9CBT-F08D9SNQVPU/image.png). I think I don't have permission to view the channel at Datastrato Community. Could you attach again?

Image

@waukin
Copy link
Contributor Author

waukin commented Feb 14, 2025

Hi @Abyss-lord, That sounds like a great idea! Feel free to modify the original output structure as needed.
By the way, I have a question—how did you create the diagram above? It looks really nice!

Abyss-lord added a commit to Abyss-lord/gravitino that referenced this issue Feb 15, 2025
…mand

Support table format output for Audit command.
Abyss-lord added a commit to Abyss-lord/gravitino that referenced this issue Feb 15, 2025
@Abyss-lord
Copy link
Contributor

Hi @Abyss-lord, That sounds like a great idea! Feel free to modify the original output structure as needed. By the way, I have a question—how did you create the diagram above? It looks really nice!

I use plantuml to create diagram, vs code + plantuml

Abyss-lord added a commit to Abyss-lord/gravitino that referenced this issue Feb 16, 2025
Abyss-lord added a commit to Abyss-lord/gravitino that referenced this issue Feb 19, 2025
…mand

Support table format output for Audit command.
Abyss-lord added a commit to Abyss-lord/gravitino that referenced this issue Feb 19, 2025
Abyss-lord added a commit to Abyss-lord/gravitino that referenced this issue Feb 24, 2025
Support table format output for Audit command.
Abyss-lord added a commit to Abyss-lord/gravitino that referenced this issue Feb 24, 2025
Support table format output for Audit command.
Abyss-lord added a commit to Abyss-lord/gravitino that referenced this issue Feb 24, 2025
justinmclean pushed a commit that referenced this issue Feb 25, 2025
### What changes were proposed in this pull request?

Support table format output for Audit command.

### Why are the changes needed?

Fix: #5746 

### Does this PR introduce _any_ user-facing change?

No

### How was this patch tested?

local test.
```bash
gcli metalake  details   --output table  -m demo_metalake --audit  -i
+-----------+--------------------------+-----------+--------------------------+
|  Creator  |       Creation at        | Modifier  |       Modified at        |
+-----------+--------------------------+-----------+--------------------------+
| anonymous | 2024-12-04T07:41:18.512Z | anonymous | 2025-01-14T07:56:25.496Z |
+-----------+--------------------------+-----------+--------------------------+

gcli catalog  details --name Hive_catalog  -i --output table  -m demo_metalake --audit
+-----------+--------------------------+-----------+-----------------------------+
|  Creator  |       Creation at        | Modifier  |         Modified at         |
+-----------+--------------------------+-----------+-----------------------------+
| anonymous | 2024-12-05T01:20:40.512Z | anonymous | 2025-02-21T08:36:50.613886Z |
+-----------+--------------------------+-----------+-----------------------------+

gcli schema  details --name Hive_catalog.default --output table  -m demo_metalake --audit -i
+---------+-------------+----------+-------------+
| Creator | Creation at | Modifier | Modified at |
+---------+-------------+----------+-------------+
| public  | N/A         | N/A      | N/A         |
+---------+-------------+----------+-------------+

gcli table  details --name Hive_catalog.default.test_dates --output table  -m demo_metalake --audit -i
+-----------+----------------------+----------+-------------+
|  Creator  |     Creation at      | Modifier | Modified at |
+-----------+----------------------+----------+-------------+
| panchenxi | 2024-07-24T07:20:52Z | N/A      | N/A         |
+-----------+----------------------+----------+-------------+
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
3 participants