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-1010216: Support more option for create or replace dynamic table #2110

Merged

Conversation

sfc-gh-aalam
Copy link
Contributor

@sfc-gh-aalam sfc-gh-aalam commented Aug 16, 2024

  1. Which Jira issue is this PR addressing? Make sure that there is an accompanying issue to your PR.

    Fixes SNOW-1010216, SNOW-1569878: Creating Dynamic Table using Snowpark does not support all options #2019

  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.
  3. Please describe how your code solves the related issue.

    Adding support to specify the following:

  • REFERSH_MODE
  • INITIALIZE
  • CLUSTER BY
  • TRANSIENT
  • DATA_RETENTION_TIME_IN_DAYS
  • MAX_DATA_EXTENSION_TIME_IN_DAYS

Copy link
Contributor

@sfc-gh-jrose sfc-gh-jrose left a comment

Choose a reason for hiding this comment

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

Are there any tests that can be added for these new parameters?

docs/source/snowpark/dataframe.rst Outdated Show resolved Hide resolved
@sfc-gh-aalam
Copy link
Contributor Author

Are there any tests that can be added for these new parameters?

Sorry. I was in the process of adding more tests. I have pushed the tests to cover all new cases now.

CHANGELOG.md Outdated Show resolved Hide resolved
Copy link

Seems like your changes contain some Local Testing changes, please request review from @snowflakedb/local-testing

Copy link

Seems like your changes contain some Local Testing changes, please request review from @snowflakedb/local-testing

Comment on lines 1127 to 1139
name,
warehouse,
lag,
comment,
replace,
if_not_exists,
refresh_mode,
initialize,
clustering_keys,
is_transient,
data_retention_time,
max_data_extension_time,
x,
Copy link
Collaborator

Choose a reason for hiding this comment

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

I suggest you use named arguments. Positional arguments are error prone when there are so many arguments.

CHANGELOG.md Outdated
@@ -6,6 +6,14 @@

#### New Features
- Added support for `snowflake.snowpark.testing.assert_dataframe_equal` that is a util function to check the equality of two Snowpark DataFrames.
- Added support for specifying the following attributes when create `DataFrame.create_or_replace_dynamic_table`:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Added support for specifying the following parameters to DataFrame.create_or_replace_dynamic_table()

return (
CREATE
+ OR
+ REPLACE
+ replace_sql
Copy link
Collaborator

Choose a reason for hiding this comment

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

How about changing to format string instead of +?

@@ -3435,7 +3444,28 @@ def create_or_replace_dynamic_table(
lag: specifies the target data freshness
comment: Adds a comment for the created table. See
`COMMENT <https://docs.snowflake.com/en/sql-reference/sql/comment>`_.
mode: Specifies the behavior of create dynamic table. Allowed values are:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Does a dynamic table have truncate? I guess no. Just to double confirm.

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 does not support it in the create or replace dynamic table api. Here we map
overwrite = CREATE OR REPLACE DYNAMIC TABLE
errorifexists = CREATE DYNAMIC TABLE
ignore = CREATE DYNAMIC TABLE IF NOT EXISTS

Copy link

Seems like your changes contain some Local Testing changes, please request review from @snowflakedb/local-testing

Copy link

Seems like your changes contain some Local Testing changes, please request review from @snowflakedb/local-testing

@sfc-gh-aalam sfc-gh-aalam merged commit 92dd396 into main Aug 22, 2024
34 checks passed
@sfc-gh-aalam sfc-gh-aalam deleted the aalam-SNOW-1010216-create-or-replace-dynamic-table-options branch August 22, 2024 17:22
@github-actions github-actions bot locked and limited conversation to collaborators Aug 22, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SNOW-1569878: Creating Dynamic Table using Snowpark does not support all options
3 participants