Trying to create redshift as a source using python...
# all-things-deployment
m
Trying to create redshift as a source using python. Getting the below error:
Copy code
Traceback (most recent call last):
  File "/usr/share/tomcat8/.local/lib/python3.8/site-packages/datahub/ingestion/run/pipeline.py", line 120, in _add_init_error_context
    yield
  File "/usr/share/tomcat8/.local/lib/python3.8/site-packages/datahub/ingestion/run/pipeline.py", line 220, in __init__
    source_class = source_registry.get(source_type)
  File "/usr/share/tomcat8/.local/lib/python3.8/site-packages/datahub/ingestion/api/registry.py", line 183, in get
    tp = self._ensure_not_lazy(key)
  File "/usr/share/tomcat8/.local/lib/python3.8/site-packages/datahub/ingestion/api/registry.py", line 127, in _ensure_not_lazy
    plugin_class = import_path(path)
  File "/usr/share/tomcat8/.local/lib/python3.8/site-packages/datahub/ingestion/api/registry.py", line 57, in import_path
    item = importlib.import_module(module_name)
  File "/usr/bin/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 843, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/usr/share/tomcat8/.local/lib/python3.8/site-packages/datahub/ingestion/source/redshift/redshift.py", line 41, in <module>
    from datahub.ingestion.source.redshift.lineage import RedshiftLineageExtractor
  File "/usr/share/tomcat8/.local/lib/python3.8/site-packages/datahub/ingestion/source/redshift/lineage.py", line 11, in <module>
    from sqllineage.runner import LineageRunner
  File "/usr/share/tomcat8/.local/lib/python3.8/site-packages/sqllineage/__init__.py", line 41, in <module>
    _monkey_patch()
  File "/usr/share/tomcat8/.local/lib/python3.8/site-packages/sqllineage/__init__.py", line 35, in _monkey_patch
    _patch_updating_lateral_view_lexeme()
  File "/usr/share/tomcat8/.local/lib/python3.8/site-packages/sqllineage/__init__.py", line 24, in _patch_updating_lateral_view_lexeme
    if regex("LATERAL VIEW EXPLODE(col)"):
TypeError: 'str' object is not callable

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/tmp/interpreter-input-ba4237f7-4df7-4ccb-8375-0d65c6af6170.tmp", line 4, in <module>
    pipeline = Pipeline.create(
  File "/usr/share/tomcat8/.local/lib/python3.8/site-packages/datahub/ingestion/run/pipeline.py", line 334, in create
    return cls(
  File "/usr/share/tomcat8/.local/lib/python3.8/site-packages/datahub/ingestion/run/pipeline.py", line 220, in __init__
    source_class = source_registry.get(source_type)
  File "/usr/bin/lib/python3.8/contextlib.py", line 131, in __exit__
    self.gen.throw(type, value, traceback)
  File "/usr/share/tomcat8/.local/lib/python3.8/site-packages/datahub/ingestion/run/pipeline.py", line 122, in _add_init_error_context
    raise PipelineInitError(f"Failed to {step}: {e}") from e
datahub.ingestion.run.pipeline.PipelineInitError: Failed to find a registered source for type redshift: 'str' object is not callable
Script failed with status: 1
Below is the code :
Copy code
from datahub.ingestion.run.pipeline import Pipeline

# The pipeline configuration is similar to the recipe YAML files provided to the CLI tool.
pipeline = Pipeline.create(
    {
        "source": {
            "type": "redshift",
            "config": {
                "username": "username",
                "password": "password",
                "database": "db",
                "host_port": "host:5439",
                "default_schema":"schema"
            },
        },
        "sink": {
            "type": "datahub-rest",
            "config": {
              "server": "<http://host/api/gms>",
              "token" : "token"
            },
        },
    }
)

# Run the pipeline and report the results.
pipeline.run()
pipeline.pretty_print_summary()
1
s