Skip to content

Commit

Permalink
graph refactor (#292)
Browse files Browse the repository at this point in the history
  • Loading branch information
cmcarthur authored Mar 2, 2017
1 parent 80c9e9b commit 28b8067
Show file tree
Hide file tree
Showing 52 changed files with 3,538 additions and 1,938 deletions.
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.2 (unreleased)

### Changes

- Graph refactor: fix common issues with load order ([#292](https://github.com/fishtown-analytics/dbt/pull/292))

## dbt 0.7.1 (February 28, 2017)

### Overview
Expand Down
14 changes: 12 additions & 2 deletions dbt/adapters/postgres.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ def rename(cls, profile, from_name, to_name, model_name=None):

@classmethod
def execute_model(cls, profile, model):
parts = re.split(r'-- (DBT_OPERATION .*)', model.compiled_contents)
parts = re.split(r'-- (DBT_OPERATION .*)', model.get('wrapped_sql'))
connection = cls.get_connection(profile)

if flags.STRICT_MODE:
Expand All @@ -317,7 +317,7 @@ def call_expand_target_column_types(kwargs):
func_map[function](kwargs)
else:
handle, cursor = cls.add_query_to_transaction(
part, connection, model.name)
part, connection, model.get('name'))

handle.commit()

Expand Down Expand Up @@ -504,6 +504,16 @@ def commit(cls, profile):
handle = connection.get('handle')
handle.commit()

@classmethod
def rollback(cls, profile):
connection = cls.get_connection(profile)

if flags.STRICT_MODE:
validate_connection(connection)

handle = connection.get('handle')
handle.rollback()

@classmethod
def get_status(cls, cursor):
return cursor.statusmessage
Expand Down
4 changes: 2 additions & 2 deletions dbt/adapters/snowflake.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ def rename(cls, profile, from_name, to_name, model_name=None):

@classmethod
def execute_model(cls, profile, model):
parts = re.split(r'-- (DBT_OPERATION .*)', model.compiled_contents)
parts = re.split(r'-- (DBT_OPERATION .*)', model.get('wrapped_sql'))
connection = cls.get_connection(profile)

if flags.STRICT_MODE:
Expand Down Expand Up @@ -216,7 +216,7 @@ def call_expand_target_column_types(kwargs):
func_map[function](kwargs)
else:
handle, cursor = cls.add_query_to_transaction(
part, connection, model.name)
part, connection, model.get('name'))

handle.commit()

Expand Down
70 changes: 0 additions & 70 deletions dbt/archival.py

This file was deleted.

45 changes: 45 additions & 0 deletions dbt/compat.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import codecs

WHICH_PYTHON = None

try:
basestring
WHICH_PYTHON = 2
except NameError:
WHICH_PYTHON = 3

if WHICH_PYTHON == 2:
basestring = basestring
else:
basestring = str


def to_unicode(s):
if WHICH_PYTHON == 2:
return unicode(s)
else:
return str(s)


def to_string(s):
if WHICH_PYTHON == 2:
if isinstance(s, unicode):
return s
elif isinstance(s, basestring):
return to_unicode(s)
else:
return to_unicode(str(s))
else:
if isinstance(s, basestring):
return s
else:
return str(s)


def write_file(path, s):
if WHICH_PYTHON == 2:
with codecs.open(path, 'w', encoding='utf-8') as f:
return f.write(to_string(s))
else:
with open(path, 'w') as f:
return f.write(to_string(s))
Loading

0 comments on commit 28b8067

Please sign in to comment.