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: Enhance show views #15011

Closed
TCeason opened this issue Mar 19, 2024 · 9 comments · Fixed by #15109
Closed

Feature: Enhance show views #15011

TCeason opened this issue Mar 19, 2024 · 9 comments · Fixed by #15109
Assignees
Labels
C-feature Category: feature good first issue Category: good first issue

Comments

@TCeason
Copy link
Collaborator

TCeason commented Mar 19, 2024

Summary

After #14889 finished. We can enhance show views.

Display like this:

https://docs.snowflake.com/en/sql-reference/sql/show-views

And we need the most important display field is text.

text | The text of the command that created the view (e.g. CREATE VIEW …).

@TCeason TCeason added C-feature Category: feature good first issue Category: good first issue labels Mar 19, 2024
@blackstar-baba
Copy link
Contributor

LGTM

@TCeason
Copy link
Collaborator Author

TCeason commented Mar 21, 2024

LGTM

You mean you want to finish this issue? If so I can assign to you 😀

@blackstar-baba
Copy link
Contributor

yes,assign to me

@blackstar-baba
Copy link
Contributor

I need some suggestions. I know how to get view information except for the SQL from system.tables, and I also know how to get the sql by view name, but I don't know how to join them together

@blackstar-baba
Copy link
Contributor

Can i extend text column in system.tables?

@blackstar-baba
Copy link
Contributor

@TCeason

@TCeason
Copy link
Collaborator Author

TCeason commented Mar 26, 2024

Can i extend text column in system.tables?

Yes. I think it's ok. And the col can be named as 'view_query'.

And maybe we also can create a new system table named 'views'? @sundy-li

@blackstar-baba
Copy link
Contributor

SHOW FULL views IN test

┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│   tables  │ table_type │ database │ catalog │       owner      │ engine │ cluster_by │         create_time        │     num_rows     │     data_size    │ data_compressed_size │    index_size    │        view_query       │
│   String  │   String   │  String  │  String │ Nullable(String) │ String │   String   │          Timestamp         │ Nullable(UInt64) │ Nullable(UInt64) │   Nullable(UInt64)   │ Nullable(UInt64) │          String         │
├───────────┼────────────┼──────────┼─────────┼──────────────────┼────────┼────────────┼────────────────────────────┼──────────────────┼──────────────────┼──────────────────────┼──────────────────┼─────────────────────────┤
│ user_view │ BASE TABLE │ test     │ default │ NULL             │ VIEW   │            │ 2024-03-22 13:58:17.709271 │             NULL │             NULL │                 NULL │             NULL │ SELECT * FROM test.user │
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
1 row read in 8.005 sec. Processed 2 row, 495 B (0.25 row/s, 61 B/s)

@TCeason
Copy link
Collaborator Author

TCeason commented Mar 27, 2024


SHOW FULL views IN test



┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐

│   tables  │ table_type │ database │ catalog │       owner      │ engine │ cluster_by │         create_time        │     num_rows     │     data_size    │ data_compressed_size │    index_size    │        view_query       │

│   String  │   String   │  String  │  String │ Nullable(String) │ String │   String   │          Timestamp         │ Nullable(UInt64) │ Nullable(UInt64) │   Nullable(UInt64)   │ Nullable(UInt64) │          String         │

├───────────┼────────────┼──────────┼─────────┼──────────────────┼────────┼────────────┼────────────────────────────┼──────────────────┼──────────────────┼──────────────────────┼──────────────────┼─────────────────────────┤

│ user_view │ BASE TABLE │ test     │ default │ NULL             │ VIEW   │            │ 2024-03-22 13:58:17.709271 │             NULL │             NULL │                 NULL │             NULL │ SELECT * FROM test.user │

└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘

1 row read in 8.005 sec. Processed 2 row, 495 B (0.25 row/s, 61 B/s)

I think it's OK

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-feature Category: feature good first issue Category: good first issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants