Skip to content

Instantly share code, notes, and snippets.

@nobane
Created August 23, 2015 02:41
Show Gist options
  • Save nobane/469047e8f3e7fcb447d3 to your computer and use it in GitHub Desktop.
Save nobane/469047e8f3e7fcb447d3 to your computer and use it in GitHub Desktop.
def my_compare_type(context, inspected_column,
metadata_column, inspected_type, metadata_type):
replace = dict(
VARCHAR='String',
BOOLEAN='Boolean',
DATETIME='DateTime',
INTEGER='Integer',
TEXT='Text'
)
pattern = re.compile( '|'.join(replace.keys()))
left = pattern.sub(lambda x: replace[x.group()],
inspected_column.type.__class__.__name__)
right = pattern.sub(lambda x: replace[x.group()],
metadata_column.type.__class__.__name__)
return left != right
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment