-
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
Project profile combined #973
Conversation
8a08574
to
4fcf0fe
Compare
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.
this is a great start. there are 3 or 4 comments that definitely need to be addressed.
a few other random thoughts:
- love that we are deprecating
repositories
. however i imagine this will break a lot of projects & makes this 0.12 - let's talk about what is broken with packages.yml
- one thing i'd like to double check here is that the error messages are still sane. have you talked with @drewbanin about that?
@@ -42,6 +42,11 @@ def __str__(self): | |||
def __repr__(self): | |||
return '{}(**{})'.format(self.__class__.__name__, self._contents) | |||
|
|||
def __eq__(self, other): | |||
if not isinstance(other, self.__class__): | |||
return False |
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.
it seems to me that this will behave inconsistently if one is a subclass of the other:
class A(APIObject):
pass
class B(A):
pass
a = A()
b = B()
a == b # False
b == a # True
is that right?
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.
Great catch. I'll add a check that the reverse isinstance check is true as well.
'maximum': 65535, | ||
}, | ||
{ | ||
'type': 'string' |
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.
i think that depending on the python version, this can come in as a string
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.
just for my record-keeping - allowing strings is handled at connection parse time
dbt/main.py
Outdated
except project.DbtProjectError as e: | ||
if parsed.which == 'deps': | ||
# deps doesn't need a profile, so don't require one. | ||
cfg = config.Project.from_current_directory() |
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.
I like this, but it hurt my brain a little bit when I first read it. can we change the import:
import dbt.config as config
to:
from dbt.config import Project, RuntimeConfig
i think that will make it more obvious
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.
it's a bit more than just those two, but I will add explicit imports for all the config module entries
dbt/runner.py
Outdated
|
||
def deserialize_graph(self): | ||
logger.info("Loading dependency graph file.") | ||
|
||
base_target_path = self.project['target-path'] | ||
base_target_path = self.project.target_path |
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.
self.config.target_path
?
test/integration/base.py
Outdated
elif 'bigquery' in test_name: | ||
return 'bigquery' | ||
else: | ||
return 'postgres' |
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.
this is clever but i'm worried that the default postgres
is too clever. can we at least add an elif 'postgres' in test_name: return 'postgres'
and then warn if none of these are found in the test name?
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.
I can, but be warned, there are a lot!
> docker-compose run --rm test tox -e explicit-py36 -- -a type=postgres --collect-only test/integration 2> /dev/null | grep '^test_' | grep -v 'postgres' | wc -l
68
self.assertEqual(config.on_run_end, []) | ||
self.assertEqual(config.archive, []) | ||
self.assertEqual(config.seeds, {}) | ||
self.assertEqual(config.packages, PackageConfig(packages=[])) |
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.
fantastic.
try: | ||
return int(result) | ||
except ValueError: | ||
pass # let the validator or connection handle this |
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.
ah i see.
Yes, for sure!
It's not clear to me what exactly kind of data we should be getting back from that URL endpoint, basically. We can do a call about it if you'd like!
Drew and I have discussed some specific messages around |
3d43f3b
to
3a41752
Compare
3a41752
to
18a5e44
Compare
discussed in slack, review issues resolved
Merge project and profile dicts (and packages and cli vars) into a single, coherent object.
The changes are naturally pretty extensive!
I do at one point in the code make use of multiple inheritance, to represent an is-a relationship (a full config really is both a project and a profile), but I think it came out pretty well.
I believe this handles
dbt deps
anddbt debug
properly. After a lot of massaging and changes to some behaviors, integration tests pass. Unit tests went really well, almost no changes needed there!I still am going to write some unit tests for the config (there's really not too much that isn't exercised by the integration tests), but since this PR is going to take so long to digest I figured I would let you have at it while I work on those.
I'm pretty confident there are no changes of substance to dbt's actual behavior. That said, here's some changes that might not be obvious to a reviewer.
Breaking changes:
repositories
entry in dbt_project.yml. I'm not sorry.Non-breaking internals changes:
Connection
instead of copying+creating new ones. Basically, the copy model doesn't make a lot of sense with how these are instantiated and accessed. Setters call validate(), so that should be fine!Breaking integration test changes:
snowflake
in the name, same goes forbigquery
andredshift
withpostgres
as the default. Surprisingly little had to change on that front. It will error at test-import-time if you have two for some reason.setUp
is now pretty-much mandatoryproject_config
with the desired quoting. With the newsetUp
it's just not very sane to rebuild the adapter, and re-doing the adapter building/schema dropping/schema creating on snowflake (the place where we most often mess with quoting in the tests, of course) was agonizing. Tests that change quoting partway through will still work as designed. You can look at the simple copy tests for examples of the horrible machinations we have to go through.runtime-target
from the tests - it's long gone from the actual code