Use this template to start writing data applications on Snowflake using Scala.
Set the following environment variables with your Snowflake account information:
# Linux/MacOS
set SNOWSQL_ACCOUNT=<replace with your account identifer>
set SNOWSQL_USER=<replace with your username>
set SNOWSQL_PWD=<replace with your password>
set SNOWSQL_DATABASE=<replace with your database>
set SNOWSQL_SCHEMA=<replace with your schema>
set SNOWSQL_WAREHOUSE=<replace with your warehouse>
# Windows/PowerShell
$env:SNOWSQL_ACCOUNT = "<replace with your account identifer>"
$env:SNOWSQL_USER = "<replace with your username>"
$env:SNOWSQL_PWD = "<replace with your password>"
$env:SNOWSQL_DATABASE = "<replace with your database>"
$env:SNOWSQL_SCHEMA = "<replace with your schema>"
$env:SNOWSQL_WAREHOUSE = "<replace with your warehouse>"
Optional: You can set this env var permanently by editing your bash profile (on Linux/MacOS) or using the System Properties menu (on Windows).
To develop your applications locally, you will need:
- A Snowflake account
- Java 11
- Scala 2.12
- An IDE or code editor (IntelliJ, VS Code, Eclipse)
Once you've set your credentials, you can test your connection by running the run()
command
in App.scala
. You can run this method directly from your IDE, or by
running sbt run
.
You should see the following output in your terminal:
---------------------------------------------------
|"Hello world" |
---------------------------------------------------
|Welcome to Snowflake! |
|Learn more: https://www.snowflake.com/snowpark/ |
---------------------------------------------------
The GitHub Actions workflow file allows you to continously deploy your objects to Snowflake. When you're ready,
create secrets in your GitHub repository with the same name and values as the environment variables you created earler (SNOWSQL_PWD
, SNOWSQL_ACCOUNT
, etc.). The workflow will create a stage, upload the compiled .jar, and create the stored procedure object. For more information, see resources.sql
.
- procedure/: Directory for your stored procedures
- udf/: Directory for your user-defined functions
- util/: Directory for methods/classes shared between procedures and UDFs
- resources.sql: A deployment script for your objects
- pr-checks.yaml: A GitHub Actions workflow that builds the project and runs the tests for each pull request
- build-and-deploy.yaml: A GitHub Actions workflow that builds and deploys your objects to Snowflake
Have a question or ran into a bug? Please file an issue and let us know.
Have an idea for an improvement? Fork this repository and open a PR with your idea!