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

DISTKEY and SORTKEY should be in quotations #74

Merged
merged 1 commit into from Apr 20, 2016

Conversation

Projects
None yet
3 participants
@solackerman
Contributor

solackerman commented Dec 6, 2015

Redshift column names can contain spaces. A column name like Foo Bar will become a sql statement looking like this

SORTKEY (Foo Bar)

which will fail. This PR quotify's DISTKEY and SORTKEY, so they will appear like this:

SORTKEY ("Foo Bar")
@graingert

This comment has been minimized.

Show comment
Hide comment
@graingert

graingert Dec 6, 2015

Collaborator

@solackerman can you create a model + reflection tests with a column name with spaces in?
eg:

class SortKeyDistKeyWithSpaces(Base):
    __tablename__ = 'sort_key_with_spaces'
    col1 = sa.Column('col with spaces', sa.Integer(), primary_key=True)
    __table_args__ = {
        'redshift_diststyle': 'EVEN',
        'redshift_sortkey': 'col with spaces',
        'redshift_distkey': 'col with spaces',
    }
Collaborator

graingert commented Dec 6, 2015

@solackerman can you create a model + reflection tests with a column name with spaces in?
eg:

class SortKeyDistKeyWithSpaces(Base):
    __tablename__ = 'sort_key_with_spaces'
    col1 = sa.Column('col with spaces', sa.Integer(), primary_key=True)
    __table_args__ = {
        'redshift_diststyle': 'EVEN',
        'redshift_sortkey': 'col with spaces',
        'redshift_distkey': 'col with spaces',
    }
@solackerman

This comment has been minimized.

Show comment
Hide comment
@solackerman

solackerman Dec 6, 2015

Contributor

done.

Contributor

solackerman commented Dec 6, 2015

done.

@graingert

This comment has been minimized.

Show comment
Hide comment
@graingert

graingert Jan 22, 2016

Collaborator

@jklukas any thoughts?

Collaborator

graingert commented Jan 22, 2016

@jklukas any thoughts?

Show outdated Hide outdated sqlalchemy_redshift/dialect.py Outdated
@jklukas

This comment has been minimized.

Show comment
Hide comment
@jklukas

jklukas Jan 22, 2016

Collaborator

Thanks for finding this bug and putting together the PR, @solackerman. Would you agree that conditional quoting is the way to go?

Collaborator

jklukas commented Jan 22, 2016

Thanks for finding this bug and putting together the PR, @solackerman. Would you agree that conditional quoting is the way to go?

@solackerman

This comment has been minimized.

Show comment
Hide comment
@solackerman

solackerman Jan 25, 2016

Contributor

Totally agree, that's much more elegant. I'll update the PR shortly.

Contributor

solackerman commented Jan 25, 2016

Totally agree, that's much more elegant. I'll update the PR shortly.

@solackerman

This comment has been minimized.

Show comment
Hide comment
@solackerman

solackerman Jan 25, 2016

Contributor

done.

Contributor

solackerman commented Jan 25, 2016

done.

@jklukas

This comment has been minimized.

Show comment
Hide comment
@jklukas

jklukas Jan 25, 2016

Collaborator

This looks great! +1

Collaborator

jklukas commented Jan 25, 2016

This looks great! +1

@@ -44,7 +44,7 @@ class ReflectionSortKey(Base):
col2 = sa.Column(sa.Integer())
__table_args__ = (
{'redshift_diststyle': 'EVEN',
'redshift_sortkey': ('col1, col2')}
'redshift_sortkey': ('col1', 'col2')}

This comment has been minimized.

@graingert

graingert Jan 25, 2016

Collaborator

Is there any chance of this being a breaking change?

@graingert

graingert Jan 25, 2016

Collaborator

Is there any chance of this being a breaking change?

This comment has been minimized.

@graingert

graingert Jan 25, 2016

Collaborator

Might be worth documenting the fact you can no longer include two columns in one string in the sortkey

@graingert

graingert Jan 25, 2016

Collaborator

Might be worth documenting the fact you can no longer include two columns in one string in the sortkey

This comment has been minimized.

@jklukas

jklukas Jan 25, 2016

Collaborator

I'd agree that this is a breaking change that should be included in the CHANGES.rst

@jklukas

jklukas Jan 25, 2016

Collaborator

I'd agree that this is a breaking change that should be included in the CHANGES.rst

@jklukas

This comment has been minimized.

Show comment
Hide comment
@jklukas

jklukas Jan 25, 2016

Collaborator

@graingert - Do you want to give a final +1 before we merge?

I just remembered that we should probably have a note in the changelog about this as well. We should probably have a CONTRIBUTING.md to write a checklist for PRs.

Collaborator

jklukas commented Jan 25, 2016

@graingert - Do you want to give a final +1 before we merge?

I just remembered that we should probably have a note in the changelog about this as well. We should probably have a CONTRIBUTING.md to write a checklist for PRs.

@graingert

This comment has been minimized.

Show comment
Hide comment
@graingert

graingert Jan 25, 2016

Collaborator

👍

Collaborator

graingert commented Jan 25, 2016

👍

@graingert

This comment has been minimized.

Show comment
Hide comment
@graingert

graingert Apr 19, 2016

Collaborator

@solackerman can you update the CHANGELOG because this is a breaking change.

Collaborator

graingert commented Apr 19, 2016

@solackerman can you update the CHANGELOG because this is a breaking change.

@solackerman

This comment has been minimized.

Show comment
Hide comment
@solackerman

solackerman Apr 20, 2016

Contributor

Done.

Contributor

solackerman commented Apr 20, 2016

Done.

@jklukas

This comment has been minimized.

Show comment
Hide comment
@jklukas

jklukas Apr 20, 2016

Collaborator

+1

Collaborator

jklukas commented Apr 20, 2016

+1

@graingert

This comment has been minimized.

Show comment
Hide comment
@graingert

graingert Apr 20, 2016

Collaborator

@solackerman can you squash these together into one, please.

Collaborator

graingert commented Apr 20, 2016

@solackerman can you squash these together into one, please.

@solackerman

This comment has been minimized.

Show comment
Hide comment
@solackerman

solackerman Apr 20, 2016

Contributor

done.

Contributor

solackerman commented Apr 20, 2016

done.

@graingert graingert merged commit 3fa5f3d into sqlalchemy-redshift:master Apr 20, 2016

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
@solackerman

This comment has been minimized.

Show comment
Hide comment
@solackerman

solackerman Apr 20, 2016

Contributor

will there be a new release coming soon?

Contributor

solackerman commented Apr 20, 2016

will there be a new release coming soon?

@graingert

This comment has been minimized.

Show comment
Hide comment
@graingert

graingert Apr 21, 2016

Collaborator

@solackerman 0.5.0 is out now

Collaborator

graingert commented Apr 21, 2016

@solackerman 0.5.0 is out now

@solackerman

This comment has been minimized.

Show comment
Hide comment
@solackerman

solackerman Apr 21, 2016

Contributor

Amazing! Thanks :)

Contributor

solackerman commented Apr 21, 2016

Amazing! Thanks :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment