Skip to content
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

Move data type macros into dbt-core #5428

Merged
merged 3 commits into from
Jun 30, 2022
Merged

Move data type macros into dbt-core #5428

merged 3 commits into from
Jun 30, 2022

Conversation

jtcohen6
Copy link
Contributor

@jtcohen6 jtcohen6 commented Jun 30, 2022

Description

  • Move type_{X} macros from dbt-utils into dbt-core. In almost all cases, these macros are just a sugarier interface for api.Column.translate_type, which leverages built-in type capabilities
  • Add functional tests for these data types

After some back-and-forth on what the right interface ought to be, we've landed on keeping the existing one. Users can confidently access a "string" type for data type casting, by calling macro named type_string, which returns the correct word for string (text, varchar, etc) on that database

Checklist

Copy link
Contributor

@dbeatty10 dbeatty10 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I took a look at this PR plus this one. Both look awesome! Ready to rock in my opinion. 👍

So now it seems like we'd do the following:

  1. Merge this PR (you)
  2. Merge that PR (me)

Opened dbt-labs/docs.getdbt.com#1644 to handle the relevant documentation updates and assigned to myself.

Comment on lines +11 to +13
-- This will return 'text' by default
-- On Postgres + Snowflake, that's equivalent to varchar (no size)
-- Redshift will treat that as varchar(256)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm leaving these comments in, unless anyone feels strongly that they should be removed before merging. (They can always be removed after merging.)

@jtcohen6
Copy link
Contributor Author

@dbeatty10 Thanks for the quick review! Next steps:

  • I'm going to merge this PR
  • The next step will be to update + merge the PRs in adapter plugin repos
  • The final step can be to update + merge the PR in dbt-utils
  • The docs PR can be merged at any point

@jtcohen6 jtcohen6 added the Team:Adapters Issues designated for the adapter area of the code label Jun 30, 2022
@jtcohen6 jtcohen6 merged commit 3bfce2b into main Jun 30, 2022
@jtcohen6 jtcohen6 deleted the jerco/data-type-macros branch June 30, 2022 17:46
gshank pushed a commit that referenced this pull request Jul 6, 2022
* Move data type macros into dbt-core

* Changelog entry

* Code quality checks. Fix type_float
agoblet pushed a commit to BigDataRepublic/dbt-core that referenced this pull request Sep 16, 2022
* Move data type macros into dbt-core

* Changelog entry

* Code quality checks. Fix type_float
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla:yes Team:Adapters Issues designated for the adapter area of the code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants