Skip to content

Commit ebc0e40

Browse files
authored
Snowflake Dialect and Testing (#363)
1 parent 1ba82f5 commit ebc0e40

File tree

243 files changed

+13116
-155
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

243 files changed

+13116
-155
lines changed

.github/workflows/pr_testing.yml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ on:
1616
description: "Python 3.12"
1717
type: boolean
1818
default: true
19+
run-all:
20+
description: "Run All Tests"
21+
type: boolean
22+
required: false
23+
default: false
1924
run-python:
2025
description: "Run Main PyDough Tests"
2126
type: boolean
@@ -101,8 +106,9 @@ jobs:
101106
# https://docs.github.com/en/actions/learn-github-actions/expressions#contains
102107
# contains is case-insensitive
103108
if: |
109+
(github.event_name == 'pull_request' && contains(needs.get-msg.outputs.commitMsg, '[run all]')) ||
104110
(github.event_name == 'pull_request' && contains(needs.get-msg.outputs.commitMsg, '[run ci]')) ||
105-
(github.event_name == 'workflow_dispatch' && inputs.run-python)
111+
(github.event_name == 'workflow_dispatch' && (inputs.run-all || inputs.run-python))
106112
runs-on: ubuntu-latest
107113
strategy:
108114
matrix:
@@ -138,8 +144,9 @@ jobs:
138144
name: Snowflake Tests
139145
needs: [get-msg, get-py-ver-matrix]
140146
if: |
147+
(github.event_name == 'pull_request' && contains(needs.get-msg.outputs.commitMsg, '[run all]')) ||
141148
(github.event_name == 'pull_request' && contains(needs.get-msg.outputs.commitMsg, '[run sf]')) ||
142-
(github.event_name == 'workflow_dispatch' && inputs.run-sf)
149+
(github.event_name == 'workflow_dispatch' && (inputs.run-all || inputs.run-sf))
143150
uses: ./.github/workflows/sf_testing.yml
144151
secrets:
145152
SF_USERNAME: ${{ secrets.SF_USERNAME }}
@@ -154,8 +161,9 @@ jobs:
154161
name: MySQL Tests
155162
needs: [get-msg, get-py-ver-matrix]
156163
if: |
164+
(github.event_name == 'pull_request' && contains(needs.get-msg.outputs.commitMsg, '[run all]')) ||
157165
(github.event_name == 'pull_request' && contains(needs.get-msg.outputs.commitMsg, '[run mysql]')) ||
158-
(github.event_name == 'workflow_dispatch' && inputs.run-mysql)
166+
(github.event_name == 'workflow_dispatch' && (inputs.run-all || inputs.run-mysql))
159167
uses: ./.github/workflows/mysql_testing.yml # Path to MySQL workflow file
160168
secrets:
161169
MYSQL_USERNAME: ${{ secrets.MYSQL_USERNAME }}

README.md

Lines changed: 43 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,49 @@ script must be run so that the `defog.db` file is located in the `tests` directo
9797

9898
## Running CI Tests
9999

100-
To run our CI tests on your PR, you must include the flag `[run CI]` in latest
101-
commit message.
100+
When submitting a PR, you can control which CI tests run by adding special flags
101+
to your **latest commit message**.
102+
103+
**Note:** All flags are **case-insensitive**.
104+
105+
- To run **PyDough CI tests**, add: `[run CI]` (only runs **SQLite tests**, no other SQL dialects)
106+
- To run **PyDough and all dialect tests**, add: `[run all]`
107+
- To run **specific dialect tests**, use the corresponding flag as described below.
108+
109+
### Running Snowflake Tests on CI
110+
To run **Snowflake CI tests**, add the flag `[run SF]` to your commit message.
111+
112+
**Running Snowflake tests locally:**
113+
114+
1. Install the Snowflake Connector for Python with Pandas support
115+
```bash
116+
pip install "snowflake-connector-python[pandas]"
117+
```
118+
119+
2. Set your Snowflake credentials as environment variables:
120+
```bash
121+
export SF_USERNAME="your_username"
122+
export SF_PASSWORD="your_password"
123+
export SF_ACCOUNT="your_account"
124+
```
125+
126+
### Running MySQL Tests on CI
127+
To run **MySQL CI tests**, add the flag `[run mysql]` to your commit message.
128+
129+
**Running MySQL tests locally:**
130+
131+
1. Make sure you have [**Docker Desktop**](https://www.docker.com/get-started/)
132+
installed and running.
133+
134+
2. Install the MySQL Connector for Python
135+
```bash
136+
pip install mysql-connector-python
137+
```
138+
139+
3. Set your MySQL credentials as environment variables:
140+
```bash
141+
export MYSQL_USERNAME="your_username"
142+
export MYSQL_PASSWORD="your_password"
102143
103144
## Runtime Dependencies
104145

demos/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,5 @@ Once the introduction notebook is complete, you can explore the other notebooks:
2424
- [4_tpch.ipynb](notebooks/4_tpch.ipynb) provides PyDough translations for most of the TPC-H benchmark queries.
2525
- [5_what_if.ipynb](notebooks/5_what_if.ipynb) demonstrates how to do WHAT-IF analysis with PyDough.
2626
- [MySQL_TPCH.ipynb](notebooks/MySQL_TPCH.ipynb) demonstrates how to connect a MySQL database with PyDough.
27+
- [SF_TPCH_q1.ipynb](notebooks/SF_TPCH_q1.ipynb) demonstrates how to connect a Snowflake database with PyDough.
2728

demos/notebooks/1_introduction.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@
294294
"name": "python",
295295
"nbconvert_exporter": "python",
296296
"pygments_lexer": "ipython3",
297-
"version": "3.13.5"
297+
"version": "3.12.2"
298298
}
299299
},
300300
"nbformat": 4,

demos/notebooks/MySQL_TPCH.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"> You can also test with our **pre-built MySQL TPC-H database** available on **Docker Hub**.\n",
2929
">\n",
3030
"> #### 📋 Requirements\n",
31-
"> - Make sure you have **Docker** installed.\n",
31+
"> - Make sure you have **Docker Desktop** installed and running.\n",
3232
">\n",
3333
"> #### 📦 Pull and Run the Container\n",
3434
"> ```bash\n",

0 commit comments

Comments
 (0)