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

Fix Redshift column alteration bug #709

Merged
merged 2 commits into from
Jul 22, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions parsons/databases/redshift/redshift.py
Original file line number Diff line number Diff line change
Expand Up @@ -959,9 +959,14 @@ def alter_varchar_column_widths(self, tbl, table_name, drop_dependencies=False):
# associated Parsons table columns. If they are, then alter column types to expand
# their width.
for c in set(rc.keys()).intersection(set(pc.keys())):
if rc[c] < pc[c]:
if rc[c] < pc[c] and rc[c] != 65535:
logger.info(f'{c} not wide enough. Expanding column width.')
self.alter_table_column_type(table_name, c, 'varchar', varchar_width=pc[c])
# If requested size is larger than Redshift will allow,
# automatically set to Redshift's max varchar width
new_size = 65535
if pc[c] < new_size:
new_size = pc[c]
self.alter_table_column_type(table_name, c, 'varchar', varchar_width=new_size)

def alter_table_column_type(self, table_name, column_name, data_type, varchar_width=None):
"""
Expand Down