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 snowpark entities #1959

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

Conversation

sfc-gh-jsikorski
Copy link
Contributor

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 on MacOS.
  • I've confirmed that my changes are working by executing CLI's commands manually on Windows.
  • 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

Basic implementation of snowpark entities - to be updated after introducing bundle map for all entities.

…ntities

# Conflicts:
#	tests/streamlit/__snapshots__/test_commands.ambr
#	tests/test_data/projects/example_streamlit_v2/snowflake.yml
…tities_basic

# Conflicts:
#	src/snowflake/cli/_plugins/streamlit/streamlit_entity.py
@sfc-gh-jsikorski sfc-gh-jsikorski marked this pull request as ready for review December 20, 2024 13:52
@sfc-gh-jsikorski sfc-gh-jsikorski requested review from a team as code owners December 20, 2024 13:52
@sfc-gh-jsikorski sfc-gh-jsikorski mentioned this pull request Dec 20, 2024
5 tasks
@sfc-gh-jsikorski sfc-gh-jsikorski changed the title Add snowpark entitiers Add snowpark entities Dec 20, 2024
if not FeatureFlag.ENABLE_NATIVE_APP_CHILDREN.is_enabled():
raise NotImplementedError("Snowpark entity is not implemented yet")
Copy link
Contributor

Choose a reason for hiding this comment

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

What's the reasoning behind this flag?

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 was introduced in #1856
As we are not introducing entities in commands just yet, it seems reasonable to turn them off by default.

allow_shared_libraries: bool = False,
*args,
**kwargs,
):
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add type hint

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

def get_execute_sql(self, execution_arguments: List[str] | None = None):
raise NotImplementedError

def get_usage_grant_sql(self, app_role: str):
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
def get_usage_grant_sql(self, app_role: str):
def get_usage_grant_sql(self, role: str):

There's nothing app specific in this query as far as I can tell

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Comment on lines 197 to 207
def get_describe_sql(self):
return f"DESCRIBE {self.model.type.upper()} {self.identifier}"

def get_drop_sql(self):
return f"DROP {self.model.type.upper()} {self.identifier}"

def get_execute_sql(self, execution_arguments: List[str] | None = None):
raise NotImplementedError

def get_usage_grant_sql(self, app_role: str):
return f"GRANT USAGE ON {self.model.type.upper()} {self.identifier} TO ROLE {app_role}"
Copy link
Contributor

Choose a reason for hiding this comment

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

Good candidates to extract to parent, generic class.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@sfc-gh-jsikorski sfc-gh-jsikorski force-pushed the jsikorski/snowpark_entities_basic branch from 762aa80 to 801b67d Compare January 9, 2025 11:32
@sfc-gh-jsikorski sfc-gh-jsikorski requested review from sfc-gh-turbaszek and a team January 9, 2025 11:40
@sfc-gh-jsikorski sfc-gh-jsikorski mentioned this pull request Jan 9, 2025
8 tasks
"""
# 0 Create a directory for the entity
if not output_dir:
output_dir = self.root / "output" / self.model.stage
Copy link
Contributor

Choose a reason for hiding this comment

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

Output dir should be "output/bundle/snowpark"

return "\n".join(query)

def get_execute_sql(self, execution_arguments: List[str] | None = None):
raise NotImplementedError
Copy link
Contributor

@sfc-gh-astus sfc-gh-astus Jan 13, 2025

Choose a reason for hiding this comment

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

Should this be not implemented?

@sfc-gh-jsikorski sfc-gh-jsikorski force-pushed the jsikorski/snowpark_entities_basic branch from e1deb64 to 9a34c4b Compare January 13, 2025 11:34
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.

3 participants