-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
87c1089
commit d5eba55
Showing
2 changed files
with
52 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: MotherDuck Integration Test | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
test-motherduck: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.10' | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install duckdb # Install the duckdb package | ||
- name: Run MotherDuck Test | ||
env: | ||
MOTHERDUCK_TOKEN: ${{ secrets.MOTHERDUCK_TOKEN }} | ||
run: python ./tests/motherduck_test.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import os | ||
|
||
import duckdb | ||
|
||
# Load the MotherDuck token from environment variables | ||
motherduck_token = os.getenv('MOTHERDUCK_TOKEN') | ||
if not motherduck_token: | ||
raise ValueError("MOTHERDUCK_TOKEN is not set in the environment variables.") | ||
|
||
# Create a connection to MotherDuck | ||
conn = duckdb.connect(database=':memory:', access_mode='read_write', config={"access_token": motherduck_token}) | ||
|
||
# Create a test table | ||
conn.execute("CREATE TABLE test_table (id INTEGER, name VARCHAR)") | ||
|
||
# Insert data into the table | ||
conn.execute("INSERT INTO test_table VALUES (1, 'Alice'), (2, 'Bob')") | ||
|
||
# Query the table | ||
result = conn.execute("SELECT * FROM test_table").fetchall() | ||
|
||
# Check the results | ||
if result == [(1, 'Alice'), (2, 'Bob')]: | ||
print("Test Passed: Data matches expected results") | ||
else: | ||
raise Exception("Test Failed: Data does not match expected results") |