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

docs: Update sql syntax and options table (part 2) #30425

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

kay-kim
Copy link
Contributor

@kay-kim kay-kim commented Nov 11, 2024

No description provided.

@kay-kim kay-kim requested a review from a team as a code owner November 11, 2024 17:39
_cluster_name_ | The cluster to show materialized views from. If omitted, materialized views from all clusters are shown.
Option | Description
----------------------------|------------
**FROM** <schema_name> | The schema to show materialized views from. Defaults to first resolvable schema in the search path. For available schemas, see [`SHOW SCHEMAS`](../show-schemas).
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Per your suggestion from #30398 (comment)
-- Doing them in batches allowed me to do a sweep and I realized I might be letting the tail wag the dog in that what might turn out to be smaller exceptions shouldn't rule the majority. Even if decent number of exceptions, eh ... as long as we're consistent with those, we could just have 2 models.

@@ -11,12 +11,14 @@ in Materialize.

## Syntax

{{< diagram "show-materialized-views.svg" >}}
```mzsql
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines 21 to 22
**ON** <object_type> | Specifies an object type to show privileges for a particular object type. Valid values are: <div style="display: flex;"> <ul style="margin-right: 20px;"> <li><strong>TABLES</strong></li> <li><strong>TYPES</strong></li> <li><strong>SECRETS</strong></li> <li><strong>CONNECTION</strong></li> </ul> <ul> <li><strong>DATABASES</strong></li> <li><strong>SCHEMAS</strong></li> <li><strong>CLUSTERS</strong></li> <li><strong>SYSTEM</strong></li> </ul> </div>Omit to show privileges for all object types.
**FOR** <role_name> | Specifies a role for which to show the membership. Omit to show role membership for all roles.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
**ON** <object_type> | Specifies an object type to show privileges for a particular object type. Valid values are: <div style="display: flex;"> <ul style="margin-right: 20px;"> <li><strong>TABLES</strong></li> <li><strong>TYPES</strong></li> <li><strong>SECRETS</strong></li> <li><strong>CONNECTION</strong></li> </ul> <ul> <li><strong>DATABASES</strong></li> <li><strong>SCHEMAS</strong></li> <li><strong>CLUSTERS</strong></li> <li><strong>SYSTEM</strong></li> </ul> </div>Omit to show privileges for all object types.
**FOR** <role_name> | Specifies a role for which to show the membership. Omit to show role membership for all roles.
**ON** <object_type> | The object type to show privileges for. Accepted object types: <div style="display: flex;"> <ul style="margin-right: 20px;"> <li><strong>TABLES</strong></li> <li><strong>TYPES</strong></li> <li><strong>SECRETS</strong></li> <li><strong>CONNECTION</strong></li> </ul> <ul> <li><strong>DATABASES</strong></li> <li><strong>SCHEMAS</strong></li> <li><strong>CLUSTERS</strong></li> <li><strong>SYSTEM</strong></li> </ul> </div>If omitted, privileges for all object types are shown.
**FOR** <role_name> | The role for which to show role membership. If omitted, role membership for all roles is shown.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For consistency with other SHOW pages.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(also commented below because scrolling is hard ... but I overcame that inertia to copy+paste here😄)
As for the two outliers in this batch, just an oversight on my part. Am using Cursor, and sometimes, I think I'd already accepted the suggestion and don't actually tab to accept the suggestion (whereas other times, I think I didn't accept the suggestion and accidentally just add a tab).

_role_name_ | Only shows role memberships granted directly or indirectly to _role_name_.
Option | Description
---------------------------|------------
**FOR** <role_name> | Specifies a role for which to show the membership. Omit to show role membership for all roles.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
**FOR** <role_name> | Specifies a role for which to show the membership. Omit to show role membership for all roles.
**FOR** <role_name> | The role for which to show the membership. If omitted, role membership for all roles is shown.

Comment on lines 20 to 21
**LIKE** \<pattern\> | Specifies the pattern to show only the roles whose name matches the pattern.
**WHERE** <condition(s)> | Specifies the condition(s) to show only the roles that meet the condition(s).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
**LIKE** \<pattern\> | Specifies the pattern to show only the roles whose name matches the pattern.
**WHERE** <condition(s)> | Specifies the condition(s) to show only the roles that meet the condition(s).
**LIKE** \<pattern\> | The pattern to match roles against. If specified, only roles that match the specified pattern will be shown.
**WHERE** <condition(s)> | The condition(s) to match roles against. If specified, only roles that meet the specified condition(s) will be shown.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Writing "If specified" here made me realize that it doesn't make much sense that we mostly use "If omitted" elsewhere for clauses that are...optional. It'd be nice to change those occurrences to instead describe what happens if you actually use the optional clause.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯 -- Will add a patch for that.

_database&lowbar;name_ | The database to show schemas from. Defaults to the current database. For available databases, see [`SHOW DATABASES`](../show-databases).
Option | Description
------------------------------|------------
**FROM** <database_name> | Specifies the database to show schemas from. Defaults to the current database. For available databases, see [`SHOW DATABASES`](../show-databases).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
**FROM** <database_name> | Specifies the database to show schemas from. Defaults to the current database. For available databases, see [`SHOW DATABASES`](../show-databases).
**FROM** <database_name> | The database to show schemas from. Defaults to the current database. For available databases, see [`SHOW DATABASES`](../show-databases).

_schema&lowbar;name_ | The schema to show secrets from. If omitted, secrets from the first schema in the search path are shown. For available schemas, see [`SHOW SCHEMAS`](../show-schemas).
Option | Description
------------------------------|------------
**FROM** <schema_name> | Specifies the schema to show secrets from. If omitted, secrets from the first schema in the search path are shown. For available schemas, see [`SHOW SCHEMAS`](../show-schemas).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
**FROM** <schema_name> | Specifies the schema to show secrets from. If omitted, secrets from the first schema in the search path are shown. For available schemas, see [`SHOW SCHEMAS`](../show-schemas).
**FROM** <schema_name> | The schema to show secrets from. If omitted, secrets from the first schema in the search path are shown. For available schemas, see [`SHOW SCHEMAS`](../show-schemas).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same though here, but...it seems like we sometimes use these optional clauses to clarify the default behavior, which shouldn't be the case. Also valid e.g., in SHOW SCHEMAS [ FROM \<database\>].

_cluster&lowbar;name_ | The cluster to show sinks from. If omitted, sinks from all clusters are shown. For available clusters, see [`SHOW CLUSTERS`](../show-clusters).
Option | Description
------------------------------|------------
**FROM** <schema_name> | Specifies the schema to show sinks from. Defaults to first resolvable schema in the search path. For available schemas, see [`SHOW SCHEMAS`](../show-schemas).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
**FROM** <schema_name> | Specifies the schema to show sinks from. Defaults to first resolvable schema in the search path. For available schemas, see [`SHOW SCHEMAS`](../show-schemas).
**FROM** <schema_name> | The schema to show sinks from. Defaults to first resolvable schema in the search path. For available schemas, see [`SHOW SCHEMAS`](../show-schemas).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was mindlessly removing the "Specifies" because...less words > more words? Will stop here just in case you have a strong preference for including it, though.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, I think technically, "Specifies ..." is more accurate since "The schema to show sinks from" would actually describe <schema_name>. Whether I have a strong preference ... eh. Given that I know I'll do additional passes through all these files in the future, only a mild preference ... more so in that in later passes (which could even be as I work on next batch of these), it's much easier to remove text than add.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As for the two outliers in this batch, just an oversight on my part. Am using Cursor, and sometimes, I think I'd already accepted the suggestion and don't actually tab to accept the suggestion (whereas other times, I think I didn't accept the suggestion and accidentally just add a tab).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh ... Let me try in the next patch with "Specifies" -> "If specified, shows ..."

@kay-kim kay-kim force-pushed the docs-sql-syntax-options-part2 branch from 384b6a6 to 5ad9ff4 Compare November 13, 2024 16:45
_cluster&lowbar;name_ | The cluster to show materialized views from. If omitted, materialized views from all clusters are shown.
Option | Description
----------------------------|------------
**FROM** <schema_name> | If specified, only show materialized views from the specified schema. Defaults to first resolvable schema in the search path. For available schemas, see [`SHOW SCHEMAS`](../show-schemas).
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is a little repetitious with the 2 "specified" ... but eh.
I tried other variations like "If included, ... the specified schema" or "If specified, ... the given schema." or "If specified ... <schema_name>" but I think specified works better than those. Maybe during other batches/sweeps, something better will pop into mind.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants