Skip to content

Commit

Permalink
add snowflake support (#259)
Browse files Browse the repository at this point in the history
  • Loading branch information
cmcarthur committed Jan 20, 2017
1 parent b344243 commit 172c7ce
Show file tree
Hide file tree
Showing 65 changed files with 2,527 additions and 1,400 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ nosetests.xml
coverage.xml
*,cover
.hypothesis/
test.env

# Translations
*.mo
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## dbt 0.7.0 (unreleased)

#### New Features

- dbt now supports [Snowflake](https://www.snowflake.net/) as a warehouse ([#259](https://github.com/analyst-collective/dbt/pull/259))

## dbt 0.6.2 (January 16, 2017)

#### Changes
Expand Down
8 changes: 2 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python
FROM python:3.5

RUN apt-get update

Expand All @@ -8,11 +8,7 @@ RUN apt-get install -y python-dev python3-dev
RUN pip install pip --upgrade
RUN pip install virtualenv
RUN pip install virtualenvwrapper

COPY . /usr/src/app
RUN pip install tox

WORKDIR /usr/src/app
RUN cd /usr/src/app
RUN ./test/setup.sh


8 changes: 5 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,17 @@

changed_tests := `git status --porcelain | grep '^\(M\| M\|A\| A\)' | awk '{ print $$2 }' | grep '\/test_[a-zA-Z_\-\.]\+.py'`

test: test-unit test-integration
test:
@echo "Full test run starting..."
@time docker-compose run test tox

test-unit:
@echo "Unit test run starting..."
tox -e unit-py27,unit-py35
@time docker-compose run test tox -e unit-py27,unit-py35,pep8

test-integration:
@echo "Integration test run starting..."
@docker-compose run test /usr/src/app/test/integration.sh
@time docker-compose run test tox -e integration-postgres-py27,integration-postgres-py35,integration-snowflake-py27,integration-snowflake-py35

test-new:
@echo "Test run starting..."
Expand Down
6 changes: 4 additions & 2 deletions circle.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
machine:
python:
version: 3.6.0
post:
- pyenv global 2.7.9 3.5.0
- pyenv global 2.7.12 3.6.0
hosts:
database: 127.0.0.1

Expand All @@ -13,7 +15,7 @@ dependencies:
- pip install --upgrade pip setuptools || true
- pip install --upgrade tox tox-pyenv
override:
- pyenv local 2.7.9 3.5.0
- pyenv local 2.7.12 3.6.0

test:
override:
Expand Down
Empty file added dbt/adapters/__init__.py
Empty file.
5 changes: 5 additions & 0 deletions dbt/adapters/cache.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import dbt.adapters.postgres as postgres


def reset():
postgres.connection_cache = {}
35 changes: 35 additions & 0 deletions dbt/adapters/factory.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import platform

import dbt.exceptions

from dbt.adapters.postgres import PostgresAdapter
from dbt.adapters.redshift import RedshiftAdapter

if platform.system() != 'Windows':
from dbt.adapters.snowflake import SnowflakeAdapter
else:
SnowflakeAdapter = None


def get_adapter(profile):
adapter_type = profile.get('type', None)

if platform.system() == 'Windows' and \
adapter_type == 'snowflake':
raise dbt.exceptions.NotImplementedException(
"ERROR: 'snowflake' is not supported on Windows.")

adapters = {
'postgres': PostgresAdapter,
'redshift': RedshiftAdapter,
'snowflake': SnowflakeAdapter,
}

adapter = adapters.get(adapter_type, None)

if adapter is None:
raise RuntimeError(
"Invalid adapter type {}!"
.format(adapter_type))

return adapter
Loading

0 comments on commit 172c7ce

Please sign in to comment.