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

Ensure character columns are treated as string types. #1191

Merged
merged 1 commit into from
Dec 21, 2018
Merged

Ensure character columns are treated as string types. #1191

merged 1 commit into from
Dec 21, 2018

Conversation

brianhartsock
Copy link
Contributor

@brianhartsock brianhartsock commented Dec 19, 2018

Closes #1194

I was playing around with dbt archive and hit the following failure:

2018-12-18 21:44:14,545 (Thread-1): Postgres error: Value too long for character type
DETAIL:  
  -----------------------------------------------
  error:  Value too long for character type
  code:      8001
  context:   Value too long for type character(1)
  query:     2816593
  location:  funcs_string.hpp:286
  process:   query3_106_2816593 [pid=13606]
  -----------------------------------------------

Tracking this down with debug mode, the column redacted_uuid char(36), in the original table definition (Redshift) was getting recreated as "redacted_uuid" character, in the dbt archive table.

Researching this lead me to schema.py where character columns are not interpreted as string types, therefore no size character length information is used when generating the create table statement.

To note, the query to generate columns for dbt returns the following info from my redshift table:

|column_name|data_type|character_maximum_length|numeric_size|
|---------------|---------|--||
|redacted_uuiid|character|36||

I don't know the implications of this change on other databases or functionality but it seems functionally more accurate. Also, I'm fine for the resulting column to be character varying(size) as the character column is generated from an ETL tool so it's a pain to change, which would have been my first quick fix.

Happy to adjust or change based on feedback - just throwing this up since it seemed like a valuable quick fix.

@drewbanin
Copy link
Contributor

Hey @brianhartsock! This PR looks great -- nice work on adding a test :)

I just kicked off the tests in Circle -- that will run these tests with different versions of Python on pg/redshift/snowflake/bq. I think this looks pretty good to me as-is, but would also like to loop in @beckjake to take a quick look. I think we'll want to merge this for stephen-girard, right Jake?

@drewbanin drewbanin self-requested a review December 19, 2018 22:06
Copy link
Contributor

@beckjake beckjake left a comment

Choose a reason for hiding this comment

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

This PR looks good to me!

And I agree this should go in for dev/stephen-girard. The default branch is still at dev/grace-kelly, so I assume that's why it's the base.

@drewbanin drewbanin changed the base branch from dev/grace-kelly to dev/stephen-girard December 19, 2018 22:26
Copy link
Contributor

@drewbanin drewbanin left a comment

Choose a reason for hiding this comment

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

LGTM!

@drewbanin drewbanin modified the milestone: Stephen Girard Dec 21, 2018
@drewbanin drewbanin merged commit 6004bdf into dbt-labs:dev/stephen-girard Dec 21, 2018
@drewbanin
Copy link
Contributor

Merged! Thanks @brianhartsock :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants