为 Snowpark Scala 设置其他开发环境

If you are using a development environment not covered earlier (see Setting Up Your Development Environment for Snowpark Scala), see the instructions in this topic for configuring your environment to use Snowpark.

在 sbt 构建文件中使用 Snowpark 库

要将 Snowpark 库集成到使用 sbt 构建文件的项目中,请将该库添加为依赖项。

In the build.sbt file for your project, make the following changes:

  1. If the scalaVersion setting does not match the version that you plan to use, update the setting. For example:

    scalaVersion := "2.12.20"

    Note that you must use a Scala version that is supported for use with the Snowpark library.

  2. Add the Snowpark library to the list of dependencies. For example:

    libraryDependencies += "com.snowflake" % "snowpark_2.12" % "1.18.0"

在 Maven 项目中使用 Snowpark 库

To integrate the Snowpark library into a Maven project, add the library as a dependency to your pom.xml file. For example:

<dependencies>
  ...
  <dependency>
    <groupId>com.snowflake</groupId>
    <artifactId>snowpark_2.12</artifactId>
    <version>1.18.0</version>
  </dependency>
  ...
</dependencies>

Set the <version> tag to the version of the library that you want to use. Note that version 1.18.0 is used in this example for illustration purposes only. The latest available version of the driver may be higher.

下载 Snowpark 库及其依赖项

如果您未使用 sbt 或 Maven 来管理应用程序依赖项,并且需要 Snowpark 库及其依赖项的副本,则可以下载包含该库及其所有依赖项的 JAR 文件的 TAR 归档文件或者 zip 压缩文件。TAR/ZIP 归档文件包括 scaladoc 格式的 API 参考文档。

To download the Snowpark library:

  1. Go to the Snowpark Client Download (https://developers.snowflake.com/snowpark/) page, and find the version that you want to use.

  2. Browse to the directory for the version that you want to use.

    The rest of the steps use 1.18.0 as an example.

  3. Download the snowpark_2.12-1.18.0-bundle.tar.gz (or .zip) file.

    Note

    As of Snowpark 0.9.0, rather than downloading an archive file that contains the Snowpark library and its dependencies in separate JAR files, you can choose to download a single JAR file that contains the Snowpark library and its dependencies. This JAR file is named snowpark_2.12-1.18.0-with-dependencies.jar.

    If you download this JAR file, skip the rest of the steps. (The steps apply to the archive file.)

  4. If you want to verify the signature of the file:

    1. Download the snowpark_2.12-1.18.0-bundle.tar.gz.asc file.

    2. From the public keyserver, download and import the Snowflake GPG public key for the version of the library that you are using:

      • For version 1.17.0 and higher:

        $ gpg --keyserver hkp://keyserver.ubuntu.com --recv-keys 2A3149C82551A34A
      • For version 1.15.0:

        $ gpg --keyserver hkp://keyserver.ubuntu.com --recv-keys 5A125630709DD64B
      • For version 1.6.1 through 1.14.0:

        $ gpg --keyserver hkp://keyserver.ubuntu.com --recv-keys 630D9F3CAB551AF3
      • For version 0.6.0 through 1.6.0:

        $ gpg --keyserver hkp://keyserver.ubuntu.com --recv-keys 37C7086698CB005C

        Note

        If this command fails with the following error:

        gpg: keyserver receive failed: Server indicated a failure

        then specify that you want to use port 80 for the keyserver:

        gpg --keyserver hkp://keyserver.ubuntu.com:80  ...
    3. Run the gpg --verify command to verify the signature. For example:

      gpg --verify snowpark_2.12-1.18.0-bundle.tar.gz.asc snowpark_2.12-1.18.0-bundle.tar.gz

      The output of the command should indicate that the archive file was signed with this key.

      Note

      Verifying the signature produces a warning similar to the following:

      gpg: Signature made Mon 24 Sep 2018 03:03:45 AM UTC using RSA key ID <gpg_key_id>
      gpg: Good signature from "Snowflake Computing <snowflake_gpg@snowflake.net>" unknown
      gpg: WARNING: This key is not certified with a trusted signature!
      gpg: There is no indication that the signature belongs to the owner.

      To avoid the warning, you can grant the Snowflake GPG public key implicit trust.

  5. Extract the contents of the archive file.

    The README.txt file in the archive file describes the contents of each directory.

  6. Add the following extracted file and directory to the classpath for building and running your application:

    • The snowpark_2.12-1.18.0.jar file
    • The lib directory