Skip to content

Commit

Permalink
Bugfix alter_varchar_columns dependency issue (move-coop#720)
Browse files Browse the repository at this point in the history
  • Loading branch information
SorenSpicknall authored Jul 28, 2022
1 parent 09c0677 commit 686bb07
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions parsons/databases/redshift/redshift.py
Original file line number Diff line number Diff line change
Expand Up @@ -952,8 +952,6 @@ def alter_varchar_column_widths(self, tbl, table_name, drop_dependencies=False):
s, t = self.split_full_table_name(table_name)
cols = self.get_columns(s, t)
rc = {k: v['max_length'] for k, v in cols.items() if v['data_type'] == 'character varying'} # noqa: E501, E261
if drop_dependencies:
self.drop_dependencies_for_cols(s, t, rc.keys())

# Figure out if any of the destination table varchar columns are smaller than the
# associated Parsons table columns. If they are, then alter column types to expand
Expand All @@ -966,6 +964,8 @@ def alter_varchar_column_widths(self, tbl, table_name, drop_dependencies=False):
new_size = 65535
if pc[c] < new_size:
new_size = pc[c]
if drop_dependencies:
self.drop_dependencies_for_cols(s, t, [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

0 comments on commit 686bb07

Please sign in to comment.