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.
Files changed (30) hide show
  1. {informatica_python-1.6.0 → informatica_python-1.6.1}/PKG-INFO +1 -1
  2. {informatica_python-1.6.0 → informatica_python-1.6.1}/informatica_python/__init__.py +1 -1
  3. {informatica_python-1.6.0 → informatica_python-1.6.1}/informatica_python/generators/mapping_gen.py +0 -1
  4. {informatica_python-1.6.0 → informatica_python-1.6.1}/informatica_python/utils/expression_converter.py +2 -1
  5. {informatica_python-1.6.0 → informatica_python-1.6.1}/informatica_python/utils/sql_dialect.py +10 -1
  6. {informatica_python-1.6.0 → informatica_python-1.6.1}/informatica_python.egg-info/PKG-INFO +1 -1
  7. {informatica_python-1.6.0 → informatica_python-1.6.1}/pyproject.toml +1 -1
  8. {informatica_python-1.6.0 → informatica_python-1.6.1}/tests/test_integration.py +14 -0
  9. {informatica_python-1.6.0 → informatica_python-1.6.1}/LICENSE +0 -0
  10. {informatica_python-1.6.0 → informatica_python-1.6.1}/README.md +0 -0
  11. {informatica_python-1.6.0 → informatica_python-1.6.1}/informatica_python/cli.py +0 -0
  12. {informatica_python-1.6.0 → informatica_python-1.6.1}/informatica_python/converter.py +0 -0
  13. {informatica_python-1.6.0 → informatica_python-1.6.1}/informatica_python/generators/__init__.py +0 -0
  14. {informatica_python-1.6.0 → informatica_python-1.6.1}/informatica_python/generators/config_gen.py +0 -0
  15. {informatica_python-1.6.0 → informatica_python-1.6.1}/informatica_python/generators/error_log_gen.py +0 -0
  16. {informatica_python-1.6.0 → informatica_python-1.6.1}/informatica_python/generators/helper_gen.py +0 -0
  17. {informatica_python-1.6.0 → informatica_python-1.6.1}/informatica_python/generators/sql_gen.py +0 -0
  18. {informatica_python-1.6.0 → informatica_python-1.6.1}/informatica_python/generators/workflow_gen.py +0 -0
  19. {informatica_python-1.6.0 → informatica_python-1.6.1}/informatica_python/models.py +0 -0
  20. {informatica_python-1.6.0 → informatica_python-1.6.1}/informatica_python/parser.py +0 -0
  21. {informatica_python-1.6.0 → informatica_python-1.6.1}/informatica_python/utils/__init__.py +0 -0
  22. {informatica_python-1.6.0 → informatica_python-1.6.1}/informatica_python/utils/datatype_map.py +0 -0
  23. {informatica_python-1.6.0 → informatica_python-1.6.1}/informatica_python/utils/lib_adapters.py +0 -0
  24. {informatica_python-1.6.0 → informatica_python-1.6.1}/informatica_python.egg-info/SOURCES.txt +0 -0
  25. {informatica_python-1.6.0 → informatica_python-1.6.1}/informatica_python.egg-info/dependency_links.txt +0 -0
  26. {informatica_python-1.6.0 → informatica_python-1.6.1}/informatica_python.egg-info/entry_points.txt +0 -0
  27. {informatica_python-1.6.0 → informatica_python-1.6.1}/informatica_python.egg-info/requires.txt +0 -0
  28. {informatica_python-1.6.0 → informatica_python-1.6.1}/informatica_python.egg-info/top_level.txt +0 -0
  29. {informatica_python-1.6.0 → informatica_python-1.6.1}/setup.cfg +0 -0
  30. {informatica_python-1.6.0 → informatica_python-1.6.1}/tests/test_converter.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: informatica-python
3
- Version: 1.6.0
3
+ Version: 1.6.1
4
4
  Summary: Convert Informatica PowerCenter workflow XML to Python/PySpark code
5
5
  Author: Nick
6
6
  License: MIT
@@ -7,7 +7,7 @@ Licensed under the MIT License.
7
7
 
8
8
  from informatica_python.converter import InformaticaConverter
9
9
 
10
- __version__ = "1.6.0"
10
+ __version__ = "1.6.1"
11
11
  __author__ = "Nick"
12
12
  __license__ = "MIT"
13
13
  __all__ = ["InformaticaConverter"]
@@ -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"
@@ -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 ch == '(':
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:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: informatica-python
3
- Version: 1.6.0
3
+ Version: 1.6.1
4
4
  Summary: Convert Informatica PowerCenter workflow XML to Python/PySpark code
5
5
  Author: Nick
6
6
  License: MIT
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "informatica-python"
7
- version = "1.6.0"
7
+ version = "1.6.1"
8
8
  description = "Convert Informatica PowerCenter workflow XML to Python/PySpark code"
9
9
  readme = "README.md"
10
10
  license = {text = "MIT"}
@@ -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"