Skip to content

Commit

Permalink
Add integration tests for Snowflake database (close #117) - WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
alexanderdean committed Dec 30, 2017
1 parent 0ae72da commit 330d4c8
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 0 deletions.
35 changes: 35 additions & 0 deletions integration/resources/good-snowflake.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Note Ruby-flavored :s at start of YAML properties. Not required
:targets:
- name: "My Snowflake database"
type: snowflake
account: snowplow
region:
database: SQLRUNNER
warehouse: SQLRUNNER_WH
username: xxx
password: xxx
host:
port:
ssl: true # Snowflake connection is always secured by TLS
variables:
test_schema: sql_runner_tests
timeFormat: "2006_01_02"
steps:
- name: Create schema and table
queries:
- name: Create schema and table
file: snowflake-sql/good/1.sql
template: true
- name: Parallel load
queries:
- name: Parallel load 1
file: snowflake-sql/good/2a.sql
template: true
- name: Parallel load 2
file: snowflake-sql/good/2b.sql
template: true
- name: Create view
queries:
- name: Create view
file: snowflake-sql/good/3.sql
template: true
9 changes: 9 additions & 0 deletions integration/resources/snowflake-sql/good/1.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
-- Test file: 1.sql

DROP SCHEMA IF EXISTS {{.test_schema}} CASCADE;

CREATE SCHEMA {{.test_schema}};

CREATE TABLE {{.test_schema}}.table1 (
age int
);
3 changes: 3 additions & 0 deletions integration/resources/snowflake-sql/good/2a.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
-- Test file: 2a.sql

INSERT INTO {{.test_schema}}.table1 VALUES (18);
3 changes: 3 additions & 0 deletions integration/resources/snowflake-sql/good/2b.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
-- Test file: 2b.sql

INSERT INTO {{.test_schema}}.table1 VALUES (32);
4 changes: 4 additions & 0 deletions integration/resources/snowflake-sql/good/3.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
-- Test file: 3.sql

CREATE VIEW {{.test_schema}}.view_{{nowWithFormat .timeFormat}} AS
SELECT AVG(age)::int AS average_age FROM {{.test_schema}}.table1;

0 comments on commit 330d4c8

Please sign in to comment.