-
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
fewer adapters will need to re-implement basic_load_csv_rows #3623
Conversation
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'm all about it—let's make these macros more modular, and make the lives of adapter plugin maintainers easier.
Answers to your questions:
- Agreed, it's a bit silly that the only difference between
default__load_csv_rows
andbasic_load_csv_rows
is setting the batch size to 10000. I'd be open to new dispatched macros forget_csv_batch_size()
andget_csv_insert_into_sql()
. - I gave this a bit of thought. Our general rule is: All explicit SQL should be wrapped in Jinja macros. All implicit or non-SQL behavior of databases should be set in python. There are adapter plugins that leverage multiple connection options—e.g.
dbt-spark
usespyodbc
for some, not others—which is an argument in favor of adding aSQLConnectionManager
property/method. This one is tricky, but I think a SQL param is SQL, sort of, so I'm happy setting it in a Jinja macro. - No strong preference here. In other places, I think we tend to define a dispatched macro, immediately followed by its default implementation, and I agree that's a bit easier to read.
took another stab at refactoring. The diff is ugly (the pedant in my is toying with two separate PRs) so make this better. I decided to keep the params for |
@jtcohen6, I responded to your feedback, but I'm not sure why some of these tests are failing |
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.
@swanderz Looking good! So sorry for the delay getting back to you on this one.
When you get a chance, could you pull the latest changes from develop
? Both in terms of the changelog placement, and also because we just overhauled our CI testing suite. I'd be curious to see if the same tests are failing as the ones you saw a few weeks ago.
core/dbt/include/global_project/macros/materializations/seed/seed.sql
Outdated
Show resolved
Hide resolved
…eed.sql Co-authored-by: Jeremy Cohen <[email protected]>
…nto get_binding_char
…to get_binding_char
Going to close and reopen just to trigger additional adapter tests |
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.
Thanks for this @swanderz!
…#3623) * fewer adapters will need to re-implemnt basic_load_csv_rows * hack version * reordering per convention * make redundant basic_load_csv_rows * for next version * Update core/dbt/include/global_project/macros/materializations/seed/seed.sql Co-authored-by: Jeremy Cohen <[email protected]> * Move up changelog entry Co-authored-by: Jeremy Cohen <[email protected]> Co-authored-by: Jeremy Cohen <[email protected]>
…#3623) * fewer adapters will need to re-implemnt basic_load_csv_rows * hack version * reordering per convention * make redundant basic_load_csv_rows * for next version * Update core/dbt/include/global_project/macros/materializations/seed/seed.sql Co-authored-by: Jeremy Cohen <[email protected]> * Move up changelog entry Co-authored-by: Jeremy Cohen <[email protected]> Co-authored-by: Jeremy Cohen <[email protected]>
dbt 0.21.0 introduced changes which dropped basic_load_csv_rows dbt-labs/dbt-core#3623. Now it's able to use the default macro default__load_csv_rows
dbt 0.21.0 introduced changes which dropped basic_load_csv_rows dbt-labs/dbt-core#3623. Now it's able to use the default macro default__load_csv_rows
dbt 0.21.0 introduced changes which dropped basic_load_csv_rows dbt-labs/dbt-core#3623. Now it's able to use the default macro default__load_csv_rows
dbt 0.21.0 introduced changes which dropped basic_load_csv_rows dbt-labs/dbt-core#3623. Now it's able to use the default macro default__load_csv_rows
resolves #3622
Description
Implements a
get_binding_char
macro, which allows for easy substitution. This will allow dbt-sqlserver, dbt-oracle, and other adapters to only implementget_binding_char
and not overload the entirebasic_load_csv_rows
Questions
basic_load_csv_rows
in favor ofdefault__load_csv_rows
whereget_batch_size()
is another dispatched macro?default_batch_size
? perhaps it's cleaner to add this as aSQLAdapterClass
property?default__
implementations. I followed this pattern, but it feels weird to haveget_binding_char
so far fromdefault__get_binding_char
. any strong opinions?Checklist
CHANGELOG.md
and added information about my change to the "dbt next" section.