informatica-python 1.9.5__tar.gz → 1.9.6__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 (31) hide show
  1. {informatica_python-1.9.5 → informatica_python-1.9.6}/PKG-INFO +1 -1
  2. {informatica_python-1.9.5 → informatica_python-1.9.6}/informatica_python/__init__.py +1 -1
  3. {informatica_python-1.9.5 → informatica_python-1.9.6}/informatica_python/generators/helper_gen.py +1 -1
  4. {informatica_python-1.9.5 → informatica_python-1.9.6}/informatica_python/generators/mapping_gen.py +12 -12
  5. {informatica_python-1.9.5 → informatica_python-1.9.6}/informatica_python.egg-info/PKG-INFO +1 -1
  6. {informatica_python-1.9.5 → informatica_python-1.9.6}/pyproject.toml +1 -1
  7. {informatica_python-1.9.5 → informatica_python-1.9.6}/tests/test_integration.py +4 -1
  8. {informatica_python-1.9.5 → informatica_python-1.9.6}/LICENSE +0 -0
  9. {informatica_python-1.9.5 → informatica_python-1.9.6}/README.md +0 -0
  10. {informatica_python-1.9.5 → informatica_python-1.9.6}/informatica_python/cli.py +0 -0
  11. {informatica_python-1.9.5 → informatica_python-1.9.6}/informatica_python/converter.py +0 -0
  12. {informatica_python-1.9.5 → informatica_python-1.9.6}/informatica_python/generators/__init__.py +0 -0
  13. {informatica_python-1.9.5 → informatica_python-1.9.6}/informatica_python/generators/config_gen.py +0 -0
  14. {informatica_python-1.9.5 → informatica_python-1.9.6}/informatica_python/generators/error_log_gen.py +0 -0
  15. {informatica_python-1.9.5 → informatica_python-1.9.6}/informatica_python/generators/sql_gen.py +0 -0
  16. {informatica_python-1.9.5 → informatica_python-1.9.6}/informatica_python/generators/workflow_gen.py +0 -0
  17. {informatica_python-1.9.5 → informatica_python-1.9.6}/informatica_python/models.py +0 -0
  18. {informatica_python-1.9.5 → informatica_python-1.9.6}/informatica_python/parser.py +0 -0
  19. {informatica_python-1.9.5 → informatica_python-1.9.6}/informatica_python/utils/__init__.py +0 -0
  20. {informatica_python-1.9.5 → informatica_python-1.9.6}/informatica_python/utils/datatype_map.py +0 -0
  21. {informatica_python-1.9.5 → informatica_python-1.9.6}/informatica_python/utils/expression_converter.py +0 -0
  22. {informatica_python-1.9.5 → informatica_python-1.9.6}/informatica_python/utils/lib_adapters.py +0 -0
  23. {informatica_python-1.9.5 → informatica_python-1.9.6}/informatica_python/utils/sql_dialect.py +0 -0
  24. {informatica_python-1.9.5 → informatica_python-1.9.6}/informatica_python.egg-info/SOURCES.txt +0 -0
  25. {informatica_python-1.9.5 → informatica_python-1.9.6}/informatica_python.egg-info/dependency_links.txt +0 -0
  26. {informatica_python-1.9.5 → informatica_python-1.9.6}/informatica_python.egg-info/entry_points.txt +0 -0
  27. {informatica_python-1.9.5 → informatica_python-1.9.6}/informatica_python.egg-info/requires.txt +0 -0
  28. {informatica_python-1.9.5 → informatica_python-1.9.6}/informatica_python.egg-info/top_level.txt +0 -0
  29. {informatica_python-1.9.5 → informatica_python-1.9.6}/setup.cfg +0 -0
  30. {informatica_python-1.9.5 → informatica_python-1.9.6}/tests/test_converter.py +0 -0
  31. {informatica_python-1.9.5 → informatica_python-1.9.6}/tests/test_expressions.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: informatica-python
3
- Version: 1.9.5
3
+ Version: 1.9.6
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.9.5"
10
+ __version__ = "1.9.6"
11
11
  __author__ = "Nick"
12
12
  __license__ = "MIT"
13
13
  __all__ = ["InformaticaConverter"]
@@ -360,7 +360,7 @@ def _add_db_functions(lines, data_lib):
360
360
  lines.append(' """Execute a SQL statement (INSERT, UPDATE, DELETE, DDL)."""')
361
361
  lines.append(" conn = get_db_connection(config, connection_name)")
362
362
  lines.append(" try:")
363
- lines.append(" if hasattr(conn, 'execute'):")
363
+ lines.append(" if hasattr(conn, 'dialect'):")
364
364
  lines.append(" from sqlalchemy import text")
365
365
  lines.append(" conn.execute(text(sql))")
366
366
  lines.append(" conn.commit()")
@@ -316,7 +316,7 @@ def generate_mapping_code(mapping: MappingDef, folder: FolderDef,
316
316
  if t.type in ("Source Qualifier", "Application Source Qualifier")]
317
317
  if sq_transforms:
318
318
  for sq in sq_transforms:
319
- _generate_source_qualifier(lines, sq, source_map, source_dfs, connector_graph, instance_map, session_overrides)
319
+ _generate_source_qualifier(lines, sq, source_map, source_dfs, connector_graph, instance_map, session_overrides, mapping_name=mapping.name, folder_name=folder.name)
320
320
  else:
321
321
  for src_name, src_def in source_map.items():
322
322
  safe = _safe_name(src_name)
@@ -347,7 +347,7 @@ def generate_mapping_code(mapping: MappingDef, folder: FolderDef,
347
347
  for tx in processing_order:
348
348
  if tx.type in ("Source Qualifier", "Application Source Qualifier"):
349
349
  continue
350
- _generate_transformation(lines, tx, connector_graph, source_dfs, transform_map, instance_map, data_lib)
350
+ _generate_transformation(lines, tx, connector_graph, source_dfs, transform_map, instance_map, data_lib, mapping_name=mapping.name, folder_name=folder.name)
351
351
 
352
352
  for tgt_name, tgt_def in target_map.items():
353
353
  _generate_target_write(lines, tgt_name, tgt_def, connector_graph, source_dfs, transform_map, instance_map, session_overrides, validate_casts=validate_casts)
@@ -626,7 +626,7 @@ def _get_processing_order(transformations, connector_graph, sq_transforms):
626
626
  return ordered
627
627
 
628
628
 
629
- def _generate_source_qualifier(lines, sq, source_map, source_dfs, connector_graph, instance_map, session_overrides=None):
629
+ def _generate_source_qualifier(lines, sq, source_map, source_dfs, connector_graph, instance_map, session_overrides=None, mapping_name="", folder_name=""):
630
630
  sq_safe = _safe_name(sq.name)
631
631
  sql_override = ""
632
632
  pre_sql = ""
@@ -665,7 +665,7 @@ def _generate_source_qualifier(lines, sq, source_map, source_dfs, connector_grap
665
665
  if not connected_sources:
666
666
  sq_src_name = sq.name[3:] if sq.name.upper().startswith("SQ_") else sq.name
667
667
  if sql_override:
668
- _emit_sql_with_params(lines, f"sql_{sq_safe}", sql_override)
668
+ _emit_sql_with_params(lines, f"sql_{sq_safe}", sql_override, mapping_name=mapping_name, folder_name=folder_name)
669
669
  lines.append(f" df_{sq_safe} = read_from_db(config, sql_{sq_safe}, 'default')")
670
670
  else:
671
671
  lines.append(f" df_{sq_safe} = read_file(config.get('sources', {{}}).get('{sq_src_name}', {{}}).get('file_path', '{sq_src_name}'),")
@@ -676,7 +676,7 @@ def _generate_source_qualifier(lines, sq, source_map, source_dfs, connector_grap
676
676
  sq_override = (session_overrides or {}).get(sq.name, {}) or (session_overrides or {}).get(src_name, {})
677
677
  conn_name = sq_override.get("connection_name") or (_safe_name(src_def.db_name) if src_def.db_name else "default")
678
678
 
679
- _emit_sql_with_params(lines, f"sql_{sq_safe}", sql_override)
679
+ _emit_sql_with_params(lines, f"sql_{sq_safe}", sql_override, mapping_name=mapping_name, folder_name=folder_name)
680
680
  lines.append(f" df_{sq_safe} = read_from_db(config, sql_{sq_safe}, '{conn_name}')")
681
681
  elif len(connected_sources) == 1:
682
682
  src_name = next(iter(connected_sources))
@@ -718,7 +718,7 @@ def _generate_source_qualifier(lines, sq, source_map, source_dfs, connector_grap
718
718
  lines.append("")
719
719
 
720
720
 
721
- def _generate_transformation(lines, tx, connector_graph, source_dfs, transform_map, instance_map, data_lib="pandas"):
721
+ def _generate_transformation(lines, tx, connector_graph, source_dfs, transform_map, instance_map, data_lib="pandas", mapping_name="", folder_name=""):
722
722
  tx_safe = _safe_name(tx.name)
723
723
  tx_type = tx.type.lower().strip()
724
724
 
@@ -765,7 +765,7 @@ def _generate_transformation(lines, tx, connector_graph, source_dfs, transform_m
765
765
  elif tx_type in ("joiner",):
766
766
  _gen_joiner_transform(lines, tx, tx_safe, input_df, input_sources, source_dfs, connector_graph, data_lib)
767
767
  elif tx_type in ("lookup procedure", "lookup"):
768
- _gen_lookup_transform(lines, tx, tx_safe, input_df, source_dfs, connector_graph, data_lib)
768
+ _gen_lookup_transform(lines, tx, tx_safe, input_df, source_dfs, connector_graph, data_lib, mapping_name=mapping_name, folder_name=folder_name)
769
769
  elif tx_type == "router":
770
770
  _gen_router_transform(lines, tx, tx_safe, input_df, source_dfs)
771
771
  elif tx_type in ("union",):
@@ -785,7 +785,7 @@ def _generate_transformation(lines, tx, connector_graph, source_dfs, transform_m
785
785
  elif tx_type in ("java",):
786
786
  _gen_java_transform(lines, tx, tx_safe, input_df, source_dfs)
787
787
  elif tx_type in ("sql",):
788
- _gen_sql_transform(lines, tx, tx_safe, input_df, source_dfs)
788
+ _gen_sql_transform(lines, tx, tx_safe, input_df, source_dfs, mapping_name=mapping_name, folder_name=folder_name)
789
789
  else:
790
790
  lines.append(f" # TODO: Unsupported transformation type '{tx.type}' - passing through")
791
791
  copy_expr = lib_copy(data_lib, input_df)
@@ -990,7 +990,7 @@ def _gen_joiner_transform(lines, tx, tx_safe, input_df, input_sources, source_df
990
990
  source_dfs[tx.name] = f"df_{tx_safe}"
991
991
 
992
992
 
993
- def _gen_lookup_transform(lines, tx, tx_safe, input_df, source_dfs, connector_graph=None, data_lib="pandas"):
993
+ def _gen_lookup_transform(lines, tx, tx_safe, input_df, source_dfs, connector_graph=None, data_lib="pandas", mapping_name="", folder_name=""):
994
994
  lookup_table = ""
995
995
  lookup_sql = ""
996
996
  lookup_condition = ""
@@ -1027,7 +1027,7 @@ def _gen_lookup_transform(lines, tx, tx_safe, input_df, source_dfs, connector_gr
1027
1027
 
1028
1028
  lines.append(f" # Lookup: {lookup_table or tx.name}")
1029
1029
  if lookup_sql:
1030
- _emit_sql_with_params(lines, f"lkp_sql_{tx_safe}", lookup_sql)
1030
+ _emit_sql_with_params(lines, f"lkp_sql_{tx_safe}", lookup_sql, mapping_name=mapping_name, folder_name=folder_name)
1031
1031
  lines.append(f" df_lkp_{tx_safe} = read_from_db(config, lkp_sql_{tx_safe}, 'default')")
1032
1032
  elif lookup_table:
1033
1033
  lines.append(f" df_lkp_{tx_safe} = read_from_db(config, 'SELECT * FROM {lookup_table}', 'default')")
@@ -1423,14 +1423,14 @@ def _gen_java_transform(lines, tx, tx_safe, input_df, source_dfs):
1423
1423
  source_dfs[tx.name] = f"df_{tx_safe}"
1424
1424
 
1425
1425
 
1426
- def _gen_sql_transform(lines, tx, tx_safe, input_df, source_dfs):
1426
+ def _gen_sql_transform(lines, tx, tx_safe, input_df, source_dfs, mapping_name="", folder_name=""):
1427
1427
  sql_query = ""
1428
1428
  for attr in tx.attributes:
1429
1429
  if attr.name == "Sql Query" and attr.value:
1430
1430
  sql_query = convert_sql_expression(attr.value)
1431
1431
  lines.append(f" # SQL Transformation: {tx.name}")
1432
1432
  if sql_query:
1433
- _emit_sql_with_params(lines, f"sql_{tx_safe}", sql_query)
1433
+ _emit_sql_with_params(lines, f"sql_{tx_safe}", sql_query, mapping_name=mapping_name, folder_name=folder_name)
1434
1434
  lines.append(f" df_{tx_safe} = read_from_db(config, sql_{tx_safe}, 'default')")
1435
1435
  else:
1436
1436
  lines.append(f" df_{tx_safe} = {input_df}.copy()")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: informatica-python
3
- Version: 1.9.5
3
+ Version: 1.9.6
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.9.5"
7
+ version = "1.9.6"
8
8
  description = "Convert Informatica PowerCenter workflow XML to Python/PySpark code"
9
9
  readme = "README.md"
10
10
  license = {text = "MIT"}
@@ -2676,6 +2676,8 @@ class TestPMVariableHandling(unittest.TestCase):
2676
2676
  if "$PMMappingName" in code:
2677
2677
  assert "resolve_builtin_variable" in code, \
2678
2678
  "SQL with $PMMappingName should call resolve_builtin_variable"
2679
+ assert "mapping_name='m_pm_vars'" in code, \
2680
+ "resolve_builtin_variable should receive actual mapping name"
2679
2681
  break
2680
2682
  finally:
2681
2683
  shutil.rmtree(tmpdir)
@@ -2691,7 +2693,8 @@ class TestExecuteSqlAlchemy(unittest.TestCase):
2691
2693
  with open(os.path.join(tmpdir, "helper_functions.py")) as f:
2692
2694
  code = f.read()
2693
2695
  exec_block = code.split("def execute_sql(")[1]
2694
- assert "sqlalchemy" in exec_block or "text(sql)" in exec_block
2696
+ assert "text(sql)" in exec_block
2697
+ assert "dialect" in exec_block, "Should check for dialect attribute to detect SQLAlchemy"
2695
2698
  finally:
2696
2699
  shutil.rmtree(tmpdir)
2697
2700