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

SNOW-1011766: Added 'snow spcs image-repository url <repo_name>' command #708

Merged
merged 14 commits into from
Feb 7, 2024

Conversation

sfc-gh-davwang
Copy link
Contributor

@sfc-gh-davwang sfc-gh-davwang commented Jan 31, 2024

Pre-review checklist

  • I've confirmed that instructions included in README.md are still correct after my changes in the codebase.
  • I've added or updated automated unit tests to verify correctness of my new code.
  • I've added or updated integration tests to verify correctness of my new code.
  • I've confirmed that my changes are working by executing CLI's commands manually.
  • I've confirmed that my changes are up-to-date with the target branch.
  • I've described my changes in the release notes.
  • I've described my changes in the section below.

Changes description

Added a new convenience command of snow spcs image-repository url that returns the full URL given a repository name. Note that image repositories do not allow for quoted identifiers, so I have added checks that repository name inputs must be unquoted identifiers.

Example Usage
get_repo_url

@sfc-gh-davwang sfc-gh-davwang force-pushed the SNOW-1011766-get-repository-url branch from 416f3f4 to d5241ab Compare January 31, 2024 19:39
@sfc-gh-davwang sfc-gh-davwang marked this pull request as draft February 1, 2024 18:43
@sfc-gh-davwang sfc-gh-davwang force-pushed the SNOW-1011766-get-repository-url branch from cb39f19 to a26a7e5 Compare February 1, 2024 18:45
@sfc-gh-davwang sfc-gh-davwang self-assigned this Feb 5, 2024
@sfc-gh-davwang sfc-gh-davwang force-pushed the SNOW-1011766-get-repository-url branch 2 times, most recently from 39c4329 to 8a35760 Compare February 5, 2024 19:45
@sfc-gh-davwang sfc-gh-davwang marked this pull request as ready for review February 5, 2024 19:59
@sfc-gh-davwang sfc-gh-davwang force-pushed the SNOW-1011766-get-repository-url branch from cbe9970 to b3c6758 Compare February 6, 2024 15:17
@sfc-gh-davwang sfc-gh-davwang force-pushed the SNOW-1011766-get-repository-url branch from b3c6758 to 4ec757e Compare February 6, 2024 16:05
sfc-gh-yiwang
sfc-gh-yiwang previously approved these changes Feb 6, 2024
Copy link
Collaborator

@sfc-gh-yiwang sfc-gh-yiwang left a comment

Choose a reason for hiding this comment

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

Overall LGTM. Left few minor comments

src/snowflake/cli/api/project/util.py Outdated Show resolved Hide resolved
src/snowflake/cli/plugins/spcs/image_repository/manager.py Outdated Show resolved Hide resolved
@sfc-gh-davwang sfc-gh-davwang force-pushed the SNOW-1011766-get-repository-url branch from a614a20 to a093314 Compare February 7, 2024 00:19
self.check_database_and_schema()
return self._execute_query(query)
return self._execute_query(query, **kwargs)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

allows you to pass cursor_class with _execute_schema_query

results = result_set.fetchall()

colored_repo_name = click.style(f"'{repo_name}'", fg="green")
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this color needed? It only cause problems with equals check

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it has marginal improvement for UI but testability is probably more important. Good point.

@sfc-gh-davwang sfc-gh-davwang force-pushed the SNOW-1011766-get-repository-url branch from 7dd3b88 to 9658712 Compare February 7, 2024 15:23
@sfc-gh-davwang sfc-gh-davwang merged commit a451ea9 into main Feb 7, 2024
17 checks passed
@sfc-gh-davwang sfc-gh-davwang deleted the SNOW-1011766-get-repository-url branch February 7, 2024 16:39
sfc-gh-sichen pushed a commit that referenced this pull request Oct 17, 2024
…and (#708)

* SNOW-1011766: Added 'snow spcs image-repository url <repo_name' command along with unit and integration tests

* SNOW-1011766: Update release notes

* SNOW-1011766: Updating integration tests for repository url to cover full flow of create repo, show repos, get repo url

* SNOW-1011766: Removing unnecessary connection parameters from test_get_repository_url_cli

* SNOW-1011766: Fixed typo in escape_like_pattern, wrote unit tests for escape_like_pattern

* SNOW-1011766: Code refactor and dealing with possibility of quoted repository name for getting image repository url

* SNOW-1011766: Code clean

* SNOW-1011766: Adding more unit tests for get_repository_url

* SNOW-1011766: Removing parts of code that deal with quoted identifiers as image repositories do not support quoted identifiers

* SNOW-1011766: Removing unnecessary URL processing

* fixup

* SNOW-1011766: Adding comment explaining usage of escape_like_pattern

* SNOW-1011766: Making error message for no image repository found more informative

* SNOW-1011766: Removing error coloring that interfered with equality checks in testing
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.

4 participants