Skip to content

Commit

Permalink
SNOW-1491199 Introduce ast.proto to the Snowpark client (#2549)
Browse files Browse the repository at this point in the history
1. Which Jira issue is this PR addressing? Make sure that there is an
accompanying issue to your PR.

   Fixes SNOW-1491199

2. Fill out the following pre-review checklist:

- [ ] I am adding a new automated test(s) to verify correctness of my
new code
- [ ] If this test skips Local Testing mode, I'm requesting review from
@snowflakedb/local-testing
   - [ ] I am adding new logging messages
   - [ ] I am adding a new telemetry message
   - [ ] I am adding new credentials
   - [ ] I am adding a new dependency
- [ ] If this is a new feature/behavior, I'm adding the Local Testing
parity changes.
- [x] I acknowledge that I have ensured my changes to be thread-safe.
Follow the link for more information: [Thread-safe Developer
Guidelines](https://docs.google.com/document/d/162d_i4zZ2AfcGRXojj0jByt8EUq-DrSHPPnTa4QvwbA/edit#bookmark=id.e82u4nekq80k)

3. Please describe how your code solves the related issue.

Introduce `ast.proto` under `src/snowflake/snowpark/_internal/proto` and
`ast_pb2.py` under the `generated` subdirectory.
`ast.proto` gets created from the contents of
[Snowpark/ast](https://github.com/snowflakedb/snowflake/tree/snowpark-phase-0/Snowpark/ast),
using `ir-dsl-c`. The chain is AST IR -> `ir-dsl-c` -> `ast.proto` ->
Python `protoc` -> `ast_pb2.py`.
We are merging both `ast.proto` and `ast_pb2.py` because the Snowpark
repository is not fully equipped to generate the Python client stubs at
packaging time. This change is a work in progress and blocked behind IT
tickets for an indeterminate amount of time.
A complete description of the AST model is too large to include here. We
are currently working on an AST IR developer guide, as well.

Co-authored-by: Arthur Zwiegincew <[email protected]>
Co-authored-by: Leonhard Spiegelberg <[email protected]>
Co-authored-by: Hemit Shah <[email protected]>
Co-authored-by: Varnika Budati <[email protected]>
Co-authored-by: Eric Vandenberg <[email protected]>
  • Loading branch information
6 people authored Oct 31, 2024
1 parent cb40783 commit 191c7b5
Show file tree
Hide file tree
Showing 3 changed files with 4,019 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ repos:
- flake8-print
args:
- --per-file-ignores=tests/*.py:T201 # prints are allowed in test files
# Ignore errors for generated protocol buffer stubs
- --exclude=src/snowflake/snowpark/_internal/proto/generated/ast_pb2.py
# Use mypy for static type checking.
- repo: https://github.com/pre-commit/mirrors-mypy
rev: 'v0.991'
Expand Down
Loading

0 comments on commit 191c7b5

Please sign in to comment.