informatica-python 1.6.0__tar.gz → 1.6.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {informatica_python-1.6.0 → informatica_python-1.6.1}/PKG-INFO +1 -1
- {informatica_python-1.6.0 → informatica_python-1.6.1}/informatica_python/__init__.py +1 -1
- {informatica_python-1.6.0 → informatica_python-1.6.1}/informatica_python/generators/mapping_gen.py +0 -1
- {informatica_python-1.6.0 → informatica_python-1.6.1}/informatica_python/utils/expression_converter.py +2 -1
- {informatica_python-1.6.0 → informatica_python-1.6.1}/informatica_python/utils/sql_dialect.py +10 -1
- {informatica_python-1.6.0 → informatica_python-1.6.1}/informatica_python.egg-info/PKG-INFO +1 -1
- {informatica_python-1.6.0 → informatica_python-1.6.1}/pyproject.toml +1 -1
- {informatica_python-1.6.0 → informatica_python-1.6.1}/tests/test_integration.py +14 -0
- {informatica_python-1.6.0 → informatica_python-1.6.1}/LICENSE +0 -0
- {informatica_python-1.6.0 → informatica_python-1.6.1}/README.md +0 -0
- {informatica_python-1.6.0 → informatica_python-1.6.1}/informatica_python/cli.py +0 -0
- {informatica_python-1.6.0 → informatica_python-1.6.1}/informatica_python/converter.py +0 -0
- {informatica_python-1.6.0 → informatica_python-1.6.1}/informatica_python/generators/__init__.py +0 -0
- {informatica_python-1.6.0 → informatica_python-1.6.1}/informatica_python/generators/config_gen.py +0 -0
- {informatica_python-1.6.0 → informatica_python-1.6.1}/informatica_python/generators/error_log_gen.py +0 -0
- {informatica_python-1.6.0 → informatica_python-1.6.1}/informatica_python/generators/helper_gen.py +0 -0
- {informatica_python-1.6.0 → informatica_python-1.6.1}/informatica_python/generators/sql_gen.py +0 -0
- {informatica_python-1.6.0 → informatica_python-1.6.1}/informatica_python/generators/workflow_gen.py +0 -0
- {informatica_python-1.6.0 → informatica_python-1.6.1}/informatica_python/models.py +0 -0
- {informatica_python-1.6.0 → informatica_python-1.6.1}/informatica_python/parser.py +0 -0
- {informatica_python-1.6.0 → informatica_python-1.6.1}/informatica_python/utils/__init__.py +0 -0
- {informatica_python-1.6.0 → informatica_python-1.6.1}/informatica_python/utils/datatype_map.py +0 -0
- {informatica_python-1.6.0 → informatica_python-1.6.1}/informatica_python/utils/lib_adapters.py +0 -0
- {informatica_python-1.6.0 → informatica_python-1.6.1}/informatica_python.egg-info/SOURCES.txt +0 -0
- {informatica_python-1.6.0 → informatica_python-1.6.1}/informatica_python.egg-info/dependency_links.txt +0 -0
- {informatica_python-1.6.0 → informatica_python-1.6.1}/informatica_python.egg-info/entry_points.txt +0 -0
- {informatica_python-1.6.0 → informatica_python-1.6.1}/informatica_python.egg-info/requires.txt +0 -0
- {informatica_python-1.6.0 → informatica_python-1.6.1}/informatica_python.egg-info/top_level.txt +0 -0
- {informatica_python-1.6.0 → informatica_python-1.6.1}/setup.cfg +0 -0
- {informatica_python-1.6.0 → informatica_python-1.6.1}/tests/test_converter.py +0 -0
{informatica_python-1.6.0 → informatica_python-1.6.1}/informatica_python/generators/mapping_gen.py
RENAMED
|
@@ -323,7 +323,6 @@ def generate_mapping_code(mapping: MappingDef, folder: FolderDef,
|
|
|
323
323
|
lines.append(" _parser = _ap.ArgumentParser()")
|
|
324
324
|
lines.append(" _parser.add_argument('--param-file', default=None)")
|
|
325
325
|
lines.append(" _parser.add_argument('--config', default='config.yml')")
|
|
326
|
-
lines.append(" _parser.add_argument('--validate-casts', action='store_true', help='Log data quality warnings on type coercion')")
|
|
327
326
|
lines.append(" _args = _parser.parse_args()")
|
|
328
327
|
lines.append(" config = load_config(_args.config, param_file=_args.param_file)")
|
|
329
328
|
lines.append(f" run_{_safe_name(mapping.name)}(config)")
|
|
@@ -472,7 +472,8 @@ def detect_sql_dialect(sql_text):
|
|
|
472
472
|
|
|
473
473
|
if "GETDATE()" in sql_upper or "ISNULL(" in sql_upper or "TOP " in sql_upper:
|
|
474
474
|
return "mssql"
|
|
475
|
-
if "NVL(" in sql_upper or "SYSDATE" in sql_upper or "ROWNUM" in sql_upper
|
|
475
|
+
if ("NVL(" in sql_upper or "SYSDATE" in sql_upper or "ROWNUM" in sql_upper
|
|
476
|
+
or "DECODE(" in sql_upper or "(+)" in sql_upper or "SYSTIMESTAMP" in sql_upper):
|
|
476
477
|
return "oracle"
|
|
477
478
|
if "NOW()" in sql_upper or "COALESCE(" in sql_upper:
|
|
478
479
|
return "postgresql"
|
{informatica_python-1.6.0 → informatica_python-1.6.1}/informatica_python/utils/sql_dialect.py
RENAMED
|
@@ -88,9 +88,17 @@ def _convert_decode(sql):
|
|
|
88
88
|
def _split_args(s):
|
|
89
89
|
args = []
|
|
90
90
|
depth = 0
|
|
91
|
+
in_quote = None
|
|
91
92
|
current = []
|
|
92
93
|
for ch in s:
|
|
93
|
-
if
|
|
94
|
+
if in_quote:
|
|
95
|
+
current.append(ch)
|
|
96
|
+
if ch == in_quote:
|
|
97
|
+
in_quote = None
|
|
98
|
+
elif ch in ("'", '"'):
|
|
99
|
+
in_quote = ch
|
|
100
|
+
current.append(ch)
|
|
101
|
+
elif ch == '(':
|
|
94
102
|
depth += 1
|
|
95
103
|
current.append(ch)
|
|
96
104
|
elif ch == ')':
|
|
@@ -166,6 +174,7 @@ def translate_sql(sql, source_dialect="auto", target_dialect="ansi"):
|
|
|
166
174
|
translated = pattern.sub(replacement, translated)
|
|
167
175
|
|
|
168
176
|
elif source_dialect in ("generic", "postgresql"):
|
|
177
|
+
translated = _convert_decode(translated)
|
|
169
178
|
for pattern, replacement in ORACLE_TO_ANSI:
|
|
170
179
|
translated = pattern.sub(replacement, translated)
|
|
171
180
|
for pattern, replacement in MSSQL_TO_ANSI:
|
|
@@ -603,6 +603,20 @@ class TestSQLDialectTranslation:
|
|
|
603
603
|
assert "COALESCE" in result
|
|
604
604
|
assert "CURRENT_TIMESTAMP" in result
|
|
605
605
|
|
|
606
|
+
def test_decode_with_quoted_commas(self):
|
|
607
|
+
from informatica_python.utils.sql_dialect import translate_sql
|
|
608
|
+
result = translate_sql("SELECT DECODE(col, 'A,B', 1, 0) FROM T", source_dialect="oracle")
|
|
609
|
+
assert "CASE" in result
|
|
610
|
+
assert "'A,B'" in result
|
|
611
|
+
|
|
612
|
+
def test_dialect_detects_decode(self):
|
|
613
|
+
from informatica_python.utils.expression_converter import detect_sql_dialect
|
|
614
|
+
assert detect_sql_dialect("SELECT DECODE(X, 1, 'A', 'B') FROM T") == "oracle"
|
|
615
|
+
|
|
616
|
+
def test_dialect_detects_outer_join(self):
|
|
617
|
+
from informatica_python.utils.expression_converter import detect_sql_dialect
|
|
618
|
+
assert detect_sql_dialect("SELECT * FROM a, b WHERE a.id = b.id(+)") == "oracle"
|
|
619
|
+
|
|
606
620
|
def test_no_change_for_clean_sql(self):
|
|
607
621
|
from informatica_python.utils.sql_dialect import translate_sql
|
|
608
622
|
sql = "SELECT * FROM employees WHERE id = 1"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{informatica_python-1.6.0 → informatica_python-1.6.1}/informatica_python/generators/__init__.py
RENAMED
|
File without changes
|
{informatica_python-1.6.0 → informatica_python-1.6.1}/informatica_python/generators/config_gen.py
RENAMED
|
File without changes
|
{informatica_python-1.6.0 → informatica_python-1.6.1}/informatica_python/generators/error_log_gen.py
RENAMED
|
File without changes
|
{informatica_python-1.6.0 → informatica_python-1.6.1}/informatica_python/generators/helper_gen.py
RENAMED
|
File without changes
|
{informatica_python-1.6.0 → informatica_python-1.6.1}/informatica_python/generators/sql_gen.py
RENAMED
|
File without changes
|
{informatica_python-1.6.0 → informatica_python-1.6.1}/informatica_python/generators/workflow_gen.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{informatica_python-1.6.0 → informatica_python-1.6.1}/informatica_python/utils/datatype_map.py
RENAMED
|
File without changes
|
{informatica_python-1.6.0 → informatica_python-1.6.1}/informatica_python/utils/lib_adapters.py
RENAMED
|
File without changes
|
{informatica_python-1.6.0 → informatica_python-1.6.1}/informatica_python.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{informatica_python-1.6.0 → informatica_python-1.6.1}/informatica_python.egg-info/entry_points.txt
RENAMED
|
File without changes
|
{informatica_python-1.6.0 → informatica_python-1.6.1}/informatica_python.egg-info/requires.txt
RENAMED
|
File without changes
|
{informatica_python-1.6.0 → informatica_python-1.6.1}/informatica_python.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|