From dfc5b226013db62357ecbd9f2b5c0e66293e4b24 Mon Sep 17 00:00:00 2001 From: Pavel Tiunov Date: Mon, 10 Sep 2018 11:54:51 -0700 Subject: [PATCH] Fix duplicate names for Salesforce custom fields --- target_postgres/db_sync.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/target_postgres/db_sync.py b/target_postgres/db_sync.py index 12e3206..4fba051 100644 --- a/target_postgres/db_sync.py +++ b/target_postgres/db_sync.py @@ -30,7 +30,9 @@ def column_type(schema_property): def inflect_column_name(name): - return inflection.underscore(re.sub(r"([A-Z]+)_([A-Z][a-z])", r'\1__\2', name)) + name = re.sub(r"([A-Z]+)_([A-Z][a-z])", r'\1__\2', name) + name = re.sub(r"([a-z\d])_([A-Z])", r'\1__\2', name) + return inflection.underscore(name) def safe_column_name(name):