Skip to content

Instantly share code, notes, and snippets.

View zdravko-il's full-sized avatar

Zdravko Yanakiev zdravko-il

View GitHub Profile
snowpark-devops
├── ci
│ └── Dockerfile
├── setup
├── snowpark_devops
├── tests
├── config.py
├── poetry.lock
├── pyproject.toml
├── requirements.other.txt
def test_filter(session: Session):
source_data = [...]
schema = T.StructType(...)
source_df = session.create_dataframe(source_data, schema=schema)
actual_df = process.filter_personal_consumption_expenditures(source_df)
expected_data = [(2021, 115.53)]
expected_df = session.create_dataframe(
expected_data,
schema=T.StructType(
[
{
"title": "PCE Forecast tests",
"assertions": [
{
"name": "Prediction returns positive int",
"value": "SELECT predict_pce_udf(2023) WHERE predict_pce_udf(2023) < 0"
}
]
}
git tag 0.3 # Release model version 0.3
git push --tags # Push to remote
LIST @DEPLOY;
-- deploy/model_0.3.joblib 512 323c36f70e713ab762d395077c9ab244 Thu, 9 Mar 2023 14:08:22 GMT
CALL register_model_to_udf('model_0.3.joblib', 'forecast_new');
SELECT forecast_new(2050);
-- 169.78
FROM python:3.8-slim
RUN apt update && apt install zip jq curl -y
RUN curl -O https://sfc-repo.snowflakecomputing.com/snowsql/bootstrap/1.2/linux_x86_64/snowsql-1.2.24-linux_x86_64.bash && \
SNOWSQL_DEST=~/bin SNOWSQL_LOGIN_SHELL=~/.profile bash snowsql-1.2.24-linux_x86_64.bash
schema-name-job:
stage: .pre
script:
- SF_SCHEMA="$(echo $CI_COMMIT_REF_NAME | sed -E 's/[^[:alnum:]]+/_/g')"
- echo "SF_SCHEMA=${SF_SCHEMA}" > variables.env
artifacts:
reports:
dotenv: variables.env
build-job:
stage: build
image: zyanakiev/snowpark-devops:latest
artifacts:
name: app
untracked: false
when: on_success
expire_in: "7 days"
paths:
- "app.zip"
deploy-job:
stage: deploy
image: zyanakiev/snowpark-devops:latest
environment:
name: $CI_COMMIT_REF_SLUG
on_stop: delete-schema-job
only:
- branches
script:
- |
delete-schema-job:
stage: deploy
variables:
GIT_STRATEGY: none
environment:
name: $CI_COMMIT_REF_SLUG
action: stop
only:
- branches
image: zyanakiev/snowpark-devops:latest