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

Preparing 3.6.2 Release Changelog #249

Closed
wants to merge 54 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
01448d9
Preparing 3.6.2 Release Changelog
sfc-gh-tmathew Apr 16, 2024
26514ad
Testing github actions with for multiple workflows
sfc-gh-tmathew May 6, 2024
b25e082
testing Release branch
sfc-gh-tmathew May 6, 2024
49e916c
testing setup teardown using schemachange
sfc-gh-tmathew May 6, 2024
7cf619f
testing snowsql variable substitution
sfc-gh-tmathew May 6, 2024
4e9ae5b
testing snowsql
sfc-gh-tmathew May 6, 2024
4105da9
Testing schemachange using schemachange
sfc-gh-tmathew May 6, 2024
d346f49
Setting missing configs
sfc-gh-tmathew May 6, 2024
151ea37
parameterizing the basics Demo
sfc-gh-tmathew May 6, 2024
8655a50
testing Matrix options for scenarios
sfc-gh-tmathew May 6, 2024
5682aa6
Completing citibike setup
sfc-gh-tmathew May 6, 2024
ac2b6e6
Testing the matrix options in dev before setting up for master
sfc-gh-tmathew May 6, 2024
209361c
testing windows latest push
sfc-gh-tmathew May 6, 2024
e8f8bed
testing windows setup
sfc-gh-tmathew May 6, 2024
17c1245
testing powershell syntax
sfc-gh-tmathew May 6, 2024
fe2a874
testing rendering option in schemachange as well
sfc-gh-tmathew May 6, 2024
1a309ab
fixing path references
sfc-gh-tmathew May 6, 2024
d07feee
Pushing final changes for github actions changes
sfc-gh-tmathew May 6, 2024
b5f412e
testing in dev before merging for 3.6.2 release
sfc-gh-tmathew May 7, 2024
ffdceb1
testing EOF error
sfc-gh-tmathew May 7, 2024
2ca2c83
checking comment in the last line.
sfc-gh-tmathew May 7, 2024
c19dfb9
workaround for last comment line included in basics demo file.
sfc-gh-tmathew May 7, 2024
c435d46
testing bash shell as default for runner
sfc-gh-tmathew May 7, 2024
88bf273
preparing github actions to operate on PRs and tags
sfc-gh-tmathew May 7, 2024
212d2ea
Test stored proc block
sfc-gh-tmathew May 9, 2024
c0a25fd
workaround example for stored proc block
sfc-gh-tmathew May 9, 2024
d10954e
Testing stored procedure creation
sfc-gh-tmathew May 9, 2024
79c37a3
testing procedure code in schemachange
sfc-gh-tmathew May 9, 2024
8ee69d3
Ensuring Teardown happens whether deployment is successful or fails.
sfc-gh-tmathew May 9, 2024
d27fdeb
added missing privileges for demo
sfc-gh-tmathew May 9, 2024
67e33ff
testing failure path to teardown
sfc-gh-tmathew May 9, 2024
7ff61a6
controlling schemachange exit codes
sfc-gh-tmathew May 9, 2024
a5c3a7e
Completed testing stored procedures as well.
sfc-gh-tmathew May 9, 2024
2a3d009
Updating documentation in batches
sfc-gh-tmathew May 13, 2024
6c2c4f4
Adding method to return valid snowflake identifier string with test c…
sfc-gh-tmathew Jun 2, 2024
18c72a0
Added tests to check handle snowflake identifier fields during config…
sfc-gh-tmathew Jun 2, 2024
12893d9
Making the test for double quoted identifiers visible
sfc-gh-tmathew Jun 2, 2024
e4cdb7b
testing double quotes
sfc-gh-tmathew Jun 2, 2024
b2b3882
managing the call for testing hypenated identifiers
sfc-gh-tmathew Jun 2, 2024
b41e8e1
Tracing the reset clause to ensure correct rendering of double quoted…
sfc-gh-tmathew Jun 2, 2024
746abf8
testing rendering snowflake variable
sfc-gh-tmathew Jun 2, 2024
78bba8c
testing snowflake identifier tests
sfc-gh-tmathew Jun 2, 2024
afe4535
testing hyphenated role support
sfc-gh-tmathew Jun 2, 2024
583208a
testing passing double quoted string using environment variables.
sfc-gh-tmathew Jun 2, 2024
fbc9231
handling double quotes from environment variable
sfc-gh-tmathew Jun 2, 2024
81cc5f0
env variable
sfc-gh-tmathew Jun 2, 2024
686376a
Ignore README file changes to trigger Workflow.
sfc-gh-tmathew Jun 2, 2024
d18ca73
Ignore workflow trigger if only readme files are changed.
sfc-gh-tmathew Jun 2, 2024
f49e155
testing workflow trigger
sfc-gh-tmathew Jun 2, 2024
8ac3ebf
testing Markdown trigger to be skipped.
sfc-gh-tmathew Jun 2, 2024
fe691a5
adding gitgaurdian to repository
sfc-gh-tmathew Jun 7, 2024
198b4ef
Ran through Pre-commit and ggshield checks
sfc-gh-tmathew Jun 7, 2024
9c0a36c
Updated Main readme file for typos and references
sfc-gh-tmathew Jul 8, 2024
aa85586
commiting install readme details
sfc-gh-tmathew Jul 11, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 15 additions & 15 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

When reporting issues please include as much detail as possible about your
operating environment, schemachange version and python version. Whenever possible, please
also include a brief, self-contained code example that demonstrates the problem.
also include a brief, self-contained code example that demonstrates the problem.

We have included [issue templates for reporting bugs, requesting features and seeking clarifications.](https://github.com/Snowflake-Labs/schemachange/issues/new/choose)
Choose the appropriate issue template to contribute to the repository.
Expand All @@ -21,50 +21,50 @@ Thanks for your interest in contributing code to schemachange!
1. If you are a first-time contributor
+ Go to [Snowflake-Labs/Schemachange](https://github.com/Snowflake-Labs/schemachange) and click the "fork" button to create your own copy of the project.
+ [Clone](https://github.com/git-guides/git-clone) the project to your local computer

```shell
git clone https://github.com/your-username/schemachange.git

```

+ Change the directory

```shell
cd schemachange

```
+ Add upstream repository:

```shell
git remote add upstream https://github.com/Snowflake-Labs/schemachange

```

+ Now, `git remote -v` will show two [remote](https://github.com/git-guides/git-remote) repositories named:
+ `upstream`, which refers to the `schemachange` repository
+ `origin`, which refers to your personal fork
+ `origin`, which refers to your personal fork
+ [Pull](https://github.com/git-guides/git-pull) the latest changes from upstream, including tags:

```shell
git checkout main
git pull upstream main --tags

```

3. Develop your contribution
+ Create a branch for the features you want to work on. Since the branch name will appear in the merge message, use a sensible name such as 'update-build-library-dependencies':

```shell
git checkout -b update-build-library-dependencies
```

+ Commit locally as you progress ( [git add](https://github.com/git-guides/git-add) and [git commit](https://github.com/git-guides/git-commit) ). Use a properly formatted commit message. Be sure to document any changed behavior.
4. To submit your contribution
+ [Push](https://github.com/git-guides/git-push) your changes back to your fork on GitHub

```shell
git push origin update-build-library-dependencies

```

+ Go to GitHub. The new branch will show up with a green [Pull Request](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-pull-requests#initiating-the-pull-request) button. Make sure the title and message are clear, concise and self explanatory. Then click the button to submit it.
108 changes: 63 additions & 45 deletions .github/workflows/dev-pytest.yml
Original file line number Diff line number Diff line change
@@ -1,73 +1,91 @@
name: dev-pytest

defaults:
run:
shell: bash

on:
push:
branches:
- dev

workflow_dispatch:
workflow_dispatch:

pull_request:
types: [opened, reopened]
branches:
- "*"
paths-ignore:
- '**/*.md'
- '**/*.MD'
- '*.md'
- '**.MD'

push:
paths-ignore:
- '**/*.md'
- '**/*.MD'
- '*.md'
- '*.MD'
tags:
- "v*" # Push events to matching v*, i.e. v3.6.2, v4.0.0
branches:
- main

jobs:
build:
strategy:
fail-fast: false
matrix:
scenario-name: [ 'basics_demo', 'citibike_demo', 'citibike_demo_jinja']
os: ["ubuntu-latest"]
python-version: ["3.11"]
runs-on: ${{ matrix.os }}

env:
SNOWFLAKE_PASSWORD: ${{ secrets.SCHEMACHANGE_SNOWFLAKE_PASSWORD }}
SNOWFLAKE_USER: ${{ secrets.SCHEMACHANGE_SNOWFLAKE_USER }}
SNOWFLAKE_ACCOUNT: ${{ secrets.SCHEMACHANGE_SNOWFLAKE_ACCOUNT }}
SNOWFLAKE_CONNECTIONS_MYCONNECTION_PASSWORD: ${{ secrets.SCHEMACHANGE_SNOWFLAKE_PASSWORD }}
SNOWFLAKE_CONNECTIONS_MYCONNECTION_ACCOUNT: ${{ secrets.SCHEMACHANGE_SNOWFLAKE_ACCOUNT }}
SNOWFLAKE_CONNECTIONS_MYCONNECTION_USER: ${{ secrets.SCHEMACHANGE_SNOWFLAKE_USER }}
runs-on: ubuntu-latest
strategy:
fail-fast: false

SNOWFLAKE_DATABASE: SCHEMACHANGE_DEMO
SNOWFLAKE_WAREHOUSE: SCHEMACHANGE_DEMO_WH
SNOWFLAKE_ROLE: '"SCHEMACHANGE_DEMO-DEPLOY"'
MY_TARGET_SCHEMA: ${{ matrix.scenario-name }}_${{ github.run_number }}_${{ strategy.job-index }}
SCENARIO_NAME: ${{ matrix.scenario-name }}
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: "3.11"
python-version: ${{ matrix.python-version }}
- name: Update pip
run: |
python -m pip install --upgrade pip
- name: Install dependencies
run: |
python -m pip install -e .[dev]
- name: Test with pytest
id: pytest
run: |
pytest
- name: Setup SnowCLI connection file
run: |
echo "[connections]" > config.toml
echo "[connections.myconnection]" >> config.toml
chmod 0600 config.toml
- name: Install snowcli
- name: Test Schemachange on ${{ matrix.os }} targeting ${{ env.SNOWFLAKE_DATABASE }}.${{ env.MY_TARGET_SCHEMA }} schema
run: |
pip install snowflake-cli-labs
- name: Test Default snowcli connection
run: |
snow --version
echo "::group::Config Contents"
more config.toml
echo "::group::Setting up ${MY_TARGET_SCHEMA}"
schemachange deploy --config-folder ./demo/setup/${SCENARIO_NAME}
echo "::endgroup::"
snow --config-file config.toml connection test -c myconnection
echo "Tested SnowCLI connection successfully!"
echo "Set default connection"
snow --config-file config.toml connection set-default "myconnection"
- name: Test Basic Schemachange
run: |
snow --config-file config.toml sql -f ./demo/setup/setup_basics_demo.sql
schemachange --config-folder ./demo/basics
snow --config-file config.toml sql -f ./demo/teardown/teardown_basics_demo.sql
- name: Test Citibike Demo
run: |
snow --config-file config.toml sql -f ./demo/setup/setup_citibike_demo.sql
schemachange --config-folder ./demo/citibike
snow --config-file config.toml sql -f ./demo/teardown/teardown_citibike_demo.sql
- name: Test Citibike Demo Jinja Template
run: |
snow --config-file config.toml sql -f ./demo/setup/setup_citibike_demo_jinja.sql
schemachange --config-folder ./demo/citibike_jinja
snow --config-file config.toml sql -f ./demo/teardown/teardown_citibike_demo_jinja.sql
echo "::group::Testing Rendering to ${MY_TARGET_SCHEMA}"
schemachange render --config-folder ./demo/${SCENARIO_NAME} ./demo/${SCENARIO_NAME}/A__render.sql
schemachange render --config-folder ./demo/${SCENARIO_NAME} ./demo/${SCENARIO_NAME}/R__render.sql
schemachange render --config-folder ./demo/${SCENARIO_NAME} ./demo/${SCENARIO_NAME}/V1.0.0__render.sql
echo "::endgroup::"
echo "::group::Testing Deployment using ${MY_TARGET_SCHEMA}"
set +e
schemachange deploy --config-folder ./demo/${SCENARIO_NAME}
RESULT=$?
if [ $RESULT -eq 0 ]; then
echo "Deployment Completed!"
else
echo "Deployment Failed. Proceeding to Teardown."
fi
echo "::endgroup::"
set -e
echo "::group::Tearing down up ${MY_TARGET_SCHEMA}"
schemachange deploy --config-folder ./demo/teardown/${SCENARIO_NAME}
echo "::endgroup::"
if [ $RESULT -ne 0 ]; then
exit 1
fi
102 changes: 57 additions & 45 deletions .github/workflows/master-pytest.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,50 @@
name: master-pytest

defaults:
run:
shell: bash

on:
pull_request:
branches:
- main
paths-ignore:
- '**/*.md'
- '**/*.MD'
- '*.md'
- '*.MD'
push:
tags:
- "v*" # Push events to matching v*, i.e. v3.6.2, v4.0.0
branches:
- master

pull_request:
types: [opened, reopened]
- main
paths-ignore:
- '**/*.md'
- '**/*.MD'
- '*.md'
- '*.MD'

jobs:
build:
env:
SNOWFLAKE_PASSWORD: ${{ secrets.SCHEMACHANGE_SNOWFLAKE_PASSWORD }}
SNOWFLAKE_USER: ${{ secrets.SCHEMACHANGE_SNOWFLAKE_USER }}
SNOWFLAKE_ACCOUNT: ${{ secrets.SCHEMACHANGE_SNOWFLAKE_ACCOUNT }}
SNOWFLAKE_CONNECTIONS_MYCONNECTION_PASSWORD: ${{ secrets.SCHEMACHANGE_SNOWFLAKE_PASSWORD }}
SNOWFLAKE_CONNECTIONS_MYCONNECTION_ACCOUNT: ${{ secrets.SCHEMACHANGE_SNOWFLAKE_ACCOUNT }}
SNOWFLAKE_CONNECTIONS_MYCONNECTION_USER: ${{ secrets.SCHEMACHANGE_SNOWFLAKE_USER }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
scenario-name: [ 'basics_demo', 'citibike_demo', 'citibike_demo_jinja']
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
python-version: ["3.8", "3.9", "3.10", "3.11"]

runs-on: ${{ matrix.os }}
env:
SNOWFLAKE_PASSWORD: ${{ secrets.SCHEMACHANGE_SNOWFLAKE_PASSWORD }}
SNOWFLAKE_USER: ${{ secrets.SCHEMACHANGE_SNOWFLAKE_USER }}
SNOWFLAKE_ACCOUNT: ${{ secrets.SCHEMACHANGE_SNOWFLAKE_ACCOUNT }}
SNOWFLAKE_DATABASE: SCHEMACHANGE_DEMO
SNOWFLAKE_WAREHOUSE: SCHEMACHANGE_DEMO_WH
SNOWFLAKE_ROLE: '"SCHEMACHANGE_DEMO-DEPLOY"'
MY_TARGET_SCHEMA: ${{ matrix.scenario-name }}_${{ github.run_number }}_${{ strategy.job-index }}
SCENARIO_NAME: ${{ matrix.scenario-name }}
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }} on ${{ matrix.os }}
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
Expand All @@ -39,36 +57,30 @@ jobs:
- name: Test with pytest
run: |
pytest
- name: Setup SnowCLI connection file
- name: Test Schemachange on ${{ matrix.os }} targeting ${{ env.SNOWFLAKE_DATABASE }}.${{ env.MY_TARGET_SCHEMA }} schema
run: |
echo "[connections]" > config.toml
echo "[connections.myconnection]" >> config.toml
chmod 0600 config.toml
- name: Install snowcli
run: |
pip install snowflake-cli-labs
- name: Test Default snowcli connection
run: |
snow --version
echo "::group::Config Contents"
more config.toml
echo "::group::Setting up ${MY_TARGET_SCHEMA}"
schemachange deploy --config-folder ./demo/setup/${SCENARIO_NAME}
echo "::endgroup::"
snow --config-file config.toml connection test -c myconnection
echo "Tested SnowCLI connection successfully!"
echo "Set default connection"
snow --config-file config.toml connection set-default "myconnection"
- name: Test Basic Schemachange
run: |
snow --config-file config.toml sql -f ./demo/setup/setup_basics_demo.sql
schemachange --config-folder ./demo/basics
snow --config-file config.toml sql -f ./demo/teardown/teardown_basics_demo.sql
- name: Test Citibike Demo
run: |
snow --config-file config.toml sql -f ./demo/setup/setup_citibike_demo.sql
schemachange --config-folder ./demo/citibike
snow --config-file config.toml sql -f ./demo/teardown/teardown_citibike_demo.sql
- name: Test Citibike Demo Jinja Template
run: |
snow --config-file config.toml sql -f ./demo/setup/setup_citibike_demo_jinja.sql
schemachange --config-folder ./demo/citibike_jinja
snow --config-file config.toml sql -f ./demo/teardown/teardown_citibike_demo_jinja.sql
echo "::group::Testing Rendering to ${MY_TARGET_SCHEMA}"
schemachange render --config-folder ./demo/${SCENARIO_NAME} ./demo/${SCENARIO_NAME}/A__render.sql
schemachange render --config-folder ./demo/${SCENARIO_NAME} ./demo/${SCENARIO_NAME}/R__render.sql
schemachange render --config-folder ./demo/${SCENARIO_NAME} ./demo/${SCENARIO_NAME}/V1.0.0__render.sql
echo "::endgroup::"
echo "::group::Testing Deployment using ${MY_TARGET_SCHEMA}"
set +e
schemachange deploy --config-folder ./demo/${SCENARIO_NAME}
RESULT=$?
if [ $RESULT -eq 0 ]; then
echo "Deployment Completed!"
else
echo "Deployment Failed. Proceeding to Teardown."
fi
echo "::endgroup::"
set -e
echo "::group::Tearing down up ${MY_TARGET_SCHEMA}"
schemachange deploy --config-folder ./demo/teardown/${SCENARIO_NAME}
echo "::endgroup::"
if [ $RESULT -ne 0 ]; then
exit 1
fi
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -131,4 +131,4 @@ dmypy.json
.idea

# Mac files
**/.DS_Store
**/.DS_Store
9 changes: 8 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,11 @@ repos:
- id: ruff
args: [ --fix ]
# Run the formatter.
- id: ruff-format
- id: ruff-format

- repo: git@github.com:GitGuardian/ggshield.git
rev: v1.28.0
hooks:
- id: ggshield
language_version: python3
stages: [commit]
11 changes: 9 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,16 @@ All notable changes to this project will be documented in this file.

*The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).*

## [3.6.2] - 2023-12-07
## [3.6.2] - 2024-05-03 (TBD)
### Changed
- Aligning with snowflake [identifier requirements](https://docs.snowflake.com/en/sql-reference/identifiers-syntax).
- Aligning with snowflake [identifier requirements](https://docs.snowflake.com/en/sql-reference/identifiers-syntax) in the configuration settings
- Added Session ID as part of the initial connection successful message to be visible in the logs
- Removed pandas library dependency to improve schemachange install footprint
- Fixed the bug with `Missing default warehouse`
- Fixed Demo examples resulting from change in public data set location
- Improved unit test coverage
- Updated Github Actions Workflow to check PRs and Merges does not break the demo examples.
- Updated Docs related to latest Demo content included in schemachange

## [3.6.1] - 2023-11-15
### Added
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ A secret is just a standard variable that has been tagged as a secret. This is d
### Jinja templating engine
schemachange uses the Jinja templating engine internally and supports: [expressions](https://jinja.palletsprojects.com/en/3.0.x/templates/#expressions), [macros](https://jinja.palletsprojects.com/en/3.0.x/templates/#macros), [includes](https://jinja.palletsprojects.com/en/3.0.x/templates/#include) and [template inheritance](https://jinja.palletsprojects.com/en/3.0.x/templates/#template-inheritance).

These files can be stored in the root-folder but schemachange also provides a separate modules folder `--modules-folder`. This allows common logic to be stored outside of the main changes scripts. The [demo/citibike_jinja](demo/citibike_jinja) has a simple example that demonstrates this.
These files can be stored in the root-folder but schemachange also provides a separate modules folder `--modules-folder`. This allows common logic to be stored outside of the main changes scripts. The [demo/citibike_demo_jinja](demo/citibike_demo_jinja) has a simple example that demonstrates this.

The Jinja autoescaping feature is disabled in schemachange, this feature in Jinja is currently designed for where the output language is HTML/XML. So if you are using schemachange with untrusted inputs you will need to handle this within your change scripts.

Expand Down Expand Up @@ -225,7 +225,7 @@ Default [Password](https://docs.snowflake.com/en/user-guide/python-connector-exa
[Key Pair](https://docs.snowflake.com/en/user-guide/python-connector-example.html#using-key-pair-authentication) Authenticator| `snowflake`
[External Oauth](https://docs.snowflake.com/en/user-guide/oauth-external.html) | `oauth`
[Browser based SSO](https://docs.snowflake.com/en/user-guide/admin-security-fed-auth-use.html#setting-up-browser-based-sso) | `externalbrowser`
[Programmatic SSO](https://docs.snowflake.com/en/user-guide/admin-security-fed-auth-use.html#native-sso-okta-only) (Okta Only) | Okta URL endpoing for your Okta account typically in the form `https://<okta_account_name>.okta.com` OR `https://<okta_account_name>.oktapreview.com`
[Programmatic SSO](https://docs.snowflake.com/en/user-guide/admin-security-fed-auth-use.html#native-sso-okta-only) (Okta Only) | Okta URL endpoint for your Okta account typically in the form `https://<okta_account_name>.okta.com` OR `https://<okta_account_name>.oktapreview.com`

If an authenticator is unsupported, then schemachange will default to `snowflake`. If the authenticator is `snowflake`, and both password and key pair values are provided then schemachange will use the password over the key pair values.

Expand Down
Loading