-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add parser #292
add parser #292
Changes from all commits
78e2353
39e2c1c
6658d87
beedfd5
2473b12
50d9896
a125043
5a64113
f34892f
1a2ada7
c7dd776
8dc998b
b3b17ee
7db4b1d
7a0039d
6a3202e
2a2aec2
305c80c
77c480a
ac3e5ee
102e8df
f24c0b1
99b9ea1
d96913d
96b3d49
caf6105
d3142cb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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')) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we'll break these out into separate nodes in a future PR, yeah? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. absolutely |
||
connection = cls.get_connection(profile) | ||
|
||
if flags.STRICT_MODE: | ||
|
@@ -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() | ||
|
||
|
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import codecs | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is great |
||
|
||
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)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we'll be able to replace this with separate nodes grouped into a transaction, right?