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

[Bug]: snowflake_procedure_python fails to import #3303

Open
1 task
harukitake opened this issue Dec 18, 2024 · 7 comments
Open
1 task

[Bug]: snowflake_procedure_python fails to import #3303

harukitake opened this issue Dec 18, 2024 · 7 comments
Labels
bug Used to mark issues with provider's incorrect behavior resource:procedure_python

Comments

@harukitake
Copy link

harukitake commented Dec 18, 2024

Terraform CLI Version

1.10.0

Terraform Provider Version

v1

Company Name

No response

Terraform Configuration

resource "snowflake_procedure_python" "this" {
  database = local.database_name
  schema   = local.schema_name
  name          = "DEV_SNOWFLAKE_ALERT_SMART_NOTIFIER"
  return_type   = "VARCHAR(16777216)"
  comment       = "[開発用]Snowflake Alertの結果を通知用に加工し、指定されたメールアドレス送信する"
  packages      = ["pandas", "tabulate"]
  snowpark_package = "1.14.0"
  execute_as          = "CALLER"
  null_input_behavior = "CALLED ON NULL INPUT"
  runtime_version = "3.10"
  handler         = "main"
  procedure_definition      = file("${path.module}/snowflake_alert_smart_notifier.py")

    arguments {
      arg_name = "EMAIL_INTEGRATION_NAME"
      arg_data_type = "VARCHAR"
    }
    arguments {
      arg_name = "NOTIFICATION_EMAIL_ADDRESS"
      arg_data_type = "VARCHAR"
    }
    arguments {
      arg_name = "TITLE"
      arg_data_type = "VARCHAR"
    }
    arguments {
      arg_name = "BODY_AS_HTML"
      arg_data_type = "VARCHAR"
    }
    arguments {
      arg_name = "QUERY_UUID"
      arg_data_type = "VARCHAR"
    }
}

import {
  to = snowflake_procedure_python.this
  id = "VISION_MINDSTONE.ALERT_PROCEDURE.SNOWFLAKE_ALERT_SMART_NOTIFIER(VARCHAR, VARCHAR, VARCHAR, VARCHAR, VARCHAR)"
}

Category

category:import

Object type(s)

resource:procedure

Expected Behavior

Successful import

Actual Behavior

╷
│ Error: could not parse package from Snowflake, expected at least snowpark package, got [pandas snowflake-snowpark-python tabulate]
│ 
│ 
╵

Steps to Reproduce

  1. plan

How much impact is this issue causing?

Medium

Logs

No response

Additional Information

configuration when using v0.99.0

resource "snowflake_procedure" "this" {
  ... 
  packages = ["snowflake-snowpark-python", "pandas", "tabulate"]
  language  = "PYTHON"
  ... 
}

Would you like to implement a fix?

  • Yeah, I'll take it 😎
@harukitake harukitake added the bug Used to mark issues with provider's incorrect behavior label Dec 18, 2024
@sfc-gh-asawicki
Copy link
Collaborator

Hey @harukitake. Thanks for reporting this.

Can you please check the output of DESCRIBE PROCEDURE <your_procedure>, the packages part? Current resources expect that the snowpark version is provided - I will update the docs - so one of the packages should be snowflake-snowpark-python==<version>. If this package is listed without a version, as a current workaround, you can first recreate (there are no ALTERs for packages, unfortunately) this procedure manually, setting a concrete version for the snowpark package. Instead of doing it manually, you should be able to update the config in v0.990/v0.100.0 and tun tf plan+apply.

Just a reminder: procedure_* resources are currently in preview; the packages handling will be improved in the following provider versions.

@harukitake
Copy link
Author

harukitake commented Dec 18, 2024

The packages part is below.

I will pin the version of snowpark with v0.99.0 and then upgrade.


['_libgcc_mutex==0.1','_openmp_mutex==5.1','abseil-cpp==20211102.0','arrow-cpp==14.0.2','aws-c-auth==0.6.19','aws-c-cal==0.5.20','aws-c-common==0.8.5','aws-c-compression==0.2.16','aws-c-event-stream==0.2.15','aws-c-http==0.6.25','aws-c-io==0.13.10','aws-c-mqtt==0.7.13','aws-c-s3==0.1.51','aws-c-sdkutils==0.1.6','aws-checksums==0.1.13','aws-crt-cpp==0.18.16','aws-sdk-cpp==1.10.55','blas==1.0','boost-cpp==1.82.0','bottleneck==1.3.7','bzip2==1.0.8','c-ares==1.19.1','ca-certificates==2024.3.11','cloudpickle==2.2.1','gflags==2.2.2','glog==0.5.0','grpc-cpp==1.48.2','icu==73.1','intel-openmp==2021.4.0','krb5==1.20.1','ld_impl_linux-64==2.38','libboost==1.82.0','libbrotlicommon==1.0.9','libbrotlidec==1.0.9','libbrotlienc==1.0.9','libcurl==8.5.0','libedit==3.1.20230828','libev==4.33','libevent==2.1.12','libffi==3.4.4','libgcc-ng==11.2.0','libgomp==11.2.0','libnghttp2==1.57.0','libprotobuf==3.20.3','libssh2==1.10.0','libstdcxx-ng==11.2.0','libthrift==0.15.0','libuuid==1.41.5','lz4-c==1.9.4','mkl==2021.4.0','mkl-service==2.4.0','mkl_fft==1.3.1','mkl_random==1.2.2','ncurses==6.4','numexpr==2.8.4','numpy==1.24.3','numpy-base==1.24.3','openssl==3.0.13','orc==1.7.4','packaging==23.2','pandas==2.2.1','pyarrow==14.0.2','python==3.10.14','python-dateutil==2.8.3+snowflake1','python-tzdata==2023.3','pytz==2023.3.post1','pyyaml==6.0.1','re2==2022.04.01','readline==8.2','s2n==1.3.27','setuptools==68.2.2','six==1.16.0','snappy==1.1.10','snowflake-snowpark-python==1.14.0','sqlite==3.41.2','stored-proc-python-connector==0.27.0','tabulate==0.9.0','tk==8.6.12','typing-extensions==4.9.0','typing_extensions==4.9.0','tzdata==2024a','utf8proc==2.6.1','wheel==0.41.2','xz==5.4.6','yaml==0.2.5','zlib==1.2.13','zstd==1.5.5','ld_impl_linux-aarch64==2.38','libgfortran-ng==11.2.0','libgfortran5==11.2.0','libopenblas==0.3.21']

@sfc-gh-asawicki
Copy link
Collaborator

@harukitake is it packages or installed_packages (looks like the latter)?

@harukitake
Copy link
Author

harukitake commented Dec 18, 2024

Yes, it is installed_packages.

This is packages output.

['pandas','snowflake-snowpark-python','tabulate']

@sfc-gh-asawicki
Copy link
Collaborator

Okay, thanks! So the snowpark package version is not there. Please check if updating the resource as described changes this output (if it does, the import should work correctly). I will address this in my upcoming changes.

@harukitake
Copy link
Author

I fixed snowflake-snowpark-python version like below and upgraded to v1.
I imported the snowflake_procedure_python resource successfully.

['pandas','snowflake-snowpark-python==1.14.0','tabulate']

@sfc-gh-asawicki
Copy link
Collaborator

Great to hear that. It's good there's a workaround before we fix packages version handling for python procedures (soon).

sfc-gh-asawicki added a commit that referenced this issue Dec 20, 2024
sfc-gh-asawicki added a commit that referenced this issue Dec 20, 2024
- Update docs and migration guide
- Bump tracking version
- Fix method usage after merge (method has been removed)
- Fix whitespace
- Fix link
- Improve function and procedure examples (multiline)

References: #3303 #3302 #3298
sfc-gh-asawicki added a commit that referenced this issue Dec 20, 2024
- Update docs and migration guide
- Bump tracking version
- Fix method usage after merge (method has been removed)
- Fix whitespace
- Fix link
- Improve function and procedure examples (multiline)

References: #3303 #3302 #3298
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Used to mark issues with provider's incorrect behavior resource:procedure_python
Projects
None yet
Development

No branches or pull requests

2 participants