-
Notifications
You must be signed in to change notification settings - Fork 167
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
Try using SQL for create_schema
#183
Conversation
|
Cool! Per latest GHA run, this change seems to be working with our new testing framework, just not the legacy one. I'm going to close this PR for now, and consider it blocked by our ongoing test conversion work. |
The main value here is around converting
I'm running into a very confusing permissions issue at the intersection of the old testing framework and SQL |
create_schema
This is very interesting, do you think we will eventually move completely away from using BaseAdapter for BigQuery? |
@McKnight-42 Very cool question! I think we're still a ways away from getting there, but it does seem like the direction we're heading in, slowly. That said, work like #136 should convince us, if we weren't convinced already, that BigQuery's Python API might always be half a step ahead of its SQL API, in terms of performance / cost / reliability. So, I could see us adding bits and pieces of the |
I would add that it's indeed pretty frustrating that we can't rely only on SQL on BigQuery. #167 is yet another example on how BigQuery lacks consistency on that topic and makes it harder for its users to rely only on SQL (and that we need some smart custom dbt logic to make it easier to work with for dbt users until Google figures it out). |
tests/unit/test_bigquery_adapter.py
Outdated
def test_create_schema(self): | ||
relation = BigQueryRelation.create(database='db', schema='schema') | ||
self.adapter.create_schema(relation) | ||
self.mock_connection_manager.create_dataset.assert_called_once_with('db', 'schema') | ||
# def test_create_schema(self): | ||
# relation = BigQueryRelation.create(database='db', schema='schema') | ||
# self.adapter.create_schema(relation) | ||
# self.mock_connection_manager.create_dataset.assert_called_once_with('db', 'schema') |
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.
@jtcohen6 do we plan on leaving the test commented out or is it okay to remove?
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.
Good catch - probably okay to remove. I don't think we can have a dedicated unit test like this (mocking a Python method) if dbt is running real SQL instead. I also don't feel like we need a dedicated test for create_schema
, since it's a required "setup" step in every single functional test.
10fb844
to
79951c2
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 Looks fine to me!
resolves #182
I'd like to avoid duplicating code from
SQLAdapter
if we can help it, but I'm not sure of the right way to plumb through its methods without turningBigQueryAdapter
into an unholy hybrid ofBaseAdapter
+SQLAdapter
.Checklist
CHANGELOG.md
and added information about my change to the "dbt-bigquery next" section.