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

Add notebook to supported objects #2033

Merged
merged 3 commits into from
Jan 30, 2025
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions RELEASE-NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
* Added support for Mac Os x86_64 architecture.
* Added image repository model in snowflake.yml.
* Added `snow spcs service deploy` command.
* Added notebooks to `snow object` commands.

## Fixes and improvements

Expand Down
1 change: 1 addition & 0 deletions src/snowflake/cli/api/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class ObjectType(Enum):
)
# JOB = ObjectNames("job", "job", "jobs")
NETWORK_RULE = ObjectNames("network-rule", "network rule", "network rules")
NOTEBOOK = ObjectNames("notebook", "notebook", "notebooks")
PROCEDURE = ObjectNames("procedure", "procedure", "procedures")
ROLE = ObjectNames("role", "role", "roles")
SCHEMA = ObjectNames("schema", "schema", "schemas")
Expand Down
13 changes: 7 additions & 6 deletions tests/__snapshots__/test_help_messages.ambr
Original file line number Diff line number Diff line change
Expand Up @@ -4680,8 +4680,9 @@

Provides description of an object of given type.
Supported types: compute-pool, database, external-access-integration,
function, git-repository, integration, network-rule, procedure, role, schema,
secret, service, stage, stream, streamlit, table, task, user, view, warehouse
function, git-repository, integration, network-rule, notebook, procedure,
role, schema, secret, service, stage, stream, streamlit, table, task, user,
view, warehouse

+- Arguments ------------------------------------------------------------------+
| * object_type TEXT Type of object. For example table, database, |
Expand Down Expand Up @@ -4776,8 +4777,8 @@
Drops Snowflake object of given name and type.
Supported types: compute-pool, database, external-access-integration,
function, git-repository, image-repository, integration, network-rule,
procedure, role, schema, secret, service, stage, stream, streamlit, table,
task, user, view, warehouse
notebook, procedure, role, schema, secret, service, stage, stream, streamlit,
table, task, user, view, warehouse

+- Arguments ------------------------------------------------------------------+
| * object_type TEXT Type of object. For example table, database, |
Expand Down Expand Up @@ -4872,8 +4873,8 @@
Lists all available Snowflake objects of given type.
Supported types: compute-pool, database, external-access-integration,
function, git-repository, image-repository, integration, network-rule,
procedure, role, schema, secret, service, stage, stream, streamlit, table,
task, user, view, warehouse
notebook, procedure, role, schema, secret, service, stage, stream, streamlit,
table, task, user, view, warehouse

+- Arguments ------------------------------------------------------------------+
| * object_type TEXT Type of object. For example table, database, |
Expand Down
21 changes: 21 additions & 0 deletions tests/object/__snapshots__/test_object.ambr
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,17 @@

'''
# ---
# name: test_describe[notebook-notebook_example]
Copy link
Contributor

Choose a reason for hiding this comment

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

List is missing.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

list doesn't use snapshots:

➜ pytest object/test_object.py::test_show
================================== test session starts ===================================
...
object/test_object.py::test_show[notebook-notebooks] PASSED              [ 55%]
...

'''
+-----------------------------+
| name | type | kind |
|------+-------------+--------|
| ID | NUMBER(38,0 | COLUMN |
| NAME | VARCHAR(100 | COLUMN |
+-----------------------------+

'''
# ---
# name: test_describe[procedure-procedure_example]
'''
+-----------------------------+
Expand Down Expand Up @@ -286,6 +297,16 @@

'''
# ---
# name: test_drop[notebook-notebook_example]
'''
+--------+
| status |
|--------|
| n |
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be just n?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed :D

+--------+

'''
# ---
# name: test_drop[procedure-procedure_example]
'''
+--------+
Expand Down
2 changes: 2 additions & 0 deletions tests/object/test_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
("view", "views"),
("image-repository", "image repositories"),
("git-repository", "git repositories"),
("notebook", "notebooks"),
],
)
def test_show(
Expand Down Expand Up @@ -86,6 +87,7 @@ def test_show(
("warehouse", "warehouse_example"),
("view", "view_example"),
("git-repository", "git_repository_example"),
("notebook", "notebook_example"),
]


Expand Down