-
Notifications
You must be signed in to change notification settings - Fork 606
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
Describe VIEW for YDB CLI #9513
Describe VIEW for YDB CLI #9513
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
@@ -543,6 +545,19 @@ int TCommandDescribe::DescribeReplication(const TDriver& driver) { | |||
return PrintDescription(this, OutputFormat, result, &TCommandDescribe::PrintReplicationResponsePretty); | |||
} | |||
|
|||
int TCommandDescribe::PrintViewResponsePretty(const NYdb::NView::TDescribeViewResult& result) const { | |||
Cout << "\nQuery text: " << result.GetViewDescription().GetQueryText() << Endl; |
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 output looks like this:
- basic example, the view exists
...$ ydb scheme describe v
<view> v
Query text:
select * from t
- the view does not exist
...$ ydb scheme describe vvv
Status: SCHEME_ERROR
Issues:
<main>: Error: Path not found
- the view has captured the
TablePathPrefix
pragma
...$ ydb scheme describe path/to/a/folder/v
<view> v
Query text:
PRAGMA TablePathPrefix = "/Root/dedicated/path/to/a/folder";
select * from `/Root/dedicated/v`
- describe of a view in json format (note:
self
value is replaced with...
)
$ ydb scheme describe --format proto-json-base64 v
<view> v
{"self":{...},"query_text":"select * from t"}
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
SetDatabase(ev.get(), *Request_); | ||
ev->Record.MutableDescribePath()->SetPath(GetProtoRequest()->path()); | ||
|
||
Send(MakeTxProxyID(), ev.release()); |
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.
If you are wondering, all describe requests sent to tx proxy are going through both:
- scheme cache (with sync version flag) to retrieve the path's SchemeShard id
- SchemeShard to retrieve the most up-to-date info about the path
add a newline before the query text
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
⚪ Test history | Ya make output | Test bloat
⚪ Test history | Ya make output | Test bloat | Test bloat
🟢
*please be aware that the difference is based on comparing your commit and the last completed build from the post-commit, check comparation |
⚪ Test history | Ya make output | Test bloat
🟢
*please be aware that the difference is based on comparing your commit and the last completed build from the post-commit, check comparation |
This reverts commit 1bfcec4.
We want YDB CLI to return view query text on
ydb scheme describe view_to_describe
command.There is no generic GRPC service that can return SchemeShard's private protobuf info to YDB CLI. Ideally, we would like to implement informational tables that contain up-to-date information about the objects in the scheme. However, this is a great undertaking and it will delay the first release of views significantly.
We have decided to add a dedicated GRPC service for views and add (for now) only the
DescribeView
call there. (Eventually, we would also addCreateView
,AlterView
andDropView
calls if users asked.) This approach seems to be the currently adopted one across YDB. See the recently added replication service and object storage service which both have a single RPC in them.