Kyunghwan Choi
08/06/2024, 6:25 PMtarget-redshift
, configured everything and when I run Meltano, it seems to be connecting to redshift properly, as it creates tables, but no data is being loaded. And the run fails with BrokenPipeError
. When I load into json (using target-jsonl
, it seems to work fine, so extractor does not seem to be an issue. Thank you.Edgar Ramírez (Arch.dev)
08/06/2024, 6:50 PMKyunghwan Choi
08/06/2024, 7:05 PMCharles Feduke
08/06/2024, 7:07 PMKyunghwan Choi
08/06/2024, 7:11 PMKyunghwan Choi
08/06/2024, 7:12 PMCharles Feduke
08/06/2024, 7:18 PMaws_redshift_copy_role_arn
Charles Feduke
08/06/2024, 7:18 PMKyunghwan Choi
08/06/2024, 7:18 PMKyunghwan Choi
08/06/2024, 7:19 PMCharles Feduke
08/06/2024, 7:19 PMKyunghwan Choi
08/06/2024, 7:19 PMKyunghwan Choi
08/06/2024, 7:19 PMCharles Feduke
08/06/2024, 7:19 PMCharles Feduke
08/06/2024, 7:20 PMCharles Feduke
08/06/2024, 7:20 PMCharles Feduke
08/06/2024, 7:22 PMaws s3 cp /tmp/some-file.txt <s3://bucket/prefix/some-file.txt>
and verify quickly that wayKyunghwan Choi
08/06/2024, 7:23 PMCharles Feduke
08/06/2024, 7:23 PMAWS_PROFILE
environment variable?Kyunghwan Choi
08/06/2024, 7:24 PMKyunghwan Choi
08/06/2024, 7:24 PMaws configure
Charles Feduke
08/06/2024, 7:24 PMtarget-redshit
has the configuration option remove_s3_files
is that set to false? Will help debugging this problem.Charles Feduke
08/06/2024, 7:25 PMaws configure
-d, correct?Kyunghwan Choi
08/06/2024, 7:26 PMCharles Feduke
08/06/2024, 7:27 PMCharles Feduke
08/06/2024, 7:27 PMKyunghwan Choi
08/06/2024, 7:27 PMremove_s3_files
. Default is False. I just set it to False as well to make sure.Kyunghwan Choi
08/06/2024, 7:27 PMjsonl
target to json files.Charles Feduke
08/06/2024, 7:28 PMKyunghwan Choi
08/06/2024, 7:29 PM/home/ec2-user/.local/share/pipx/venvs/meltano/lib64/python3.9/site-packages/structlog/stdlib.py:1098: UserWarning: Remove `format_exc_info` from your processor chain if you want pretty exceptions.
ed = p(logger, meth_name, cast(EventDict, ed))
^[[2m2024-08-06T19:24:16.044211Z^[[0m [^[[32m^[[1mdebug ^[[0m] ^[[1mNeed help fixing this problem? Visit <http://melta.no/> for troubleshooting steps, or to
join our friendly Slack community.
^[[0m
Traceback (most recent call last):
File "/home/ec2-user/.local/share/pipx/venvs/meltano/lib64/python3.9/site-packages/meltano/cli/__init__.py", line 103, in _run_cli
cli(obj={"project": None})
File "/home/ec2-user/.local/share/pipx/venvs/meltano/lib64/python3.9/site-packages/click/core.py", line 1157, in __call__
return self.main(*args, **kwargs)
File "/home/ec2-user/.local/share/pipx/venvs/meltano/lib64/python3.9/site-packages/meltano/cli/cli.py", line 46, in main
return super().main(*args, windows_expand_args=False, **kwargs)
File "/home/ec2-user/.local/share/pipx/venvs/meltano/lib64/python3.9/site-packages/click/core.py", line 1078, in main
rv = self.invoke(ctx)
File "/home/ec2-user/.local/share/pipx/venvs/meltano/lib64/python3.9/site-packages/meltano/cli/utils.py", line 662, in invoke
super().invoke(ctx) # type: ignore[misc]
File "/home/ec2-user/.local/share/pipx/venvs/meltano/lib64/python3.9/site-packages/click/core.py", line 1688, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/home/ec2-user/.local/share/pipx/venvs/meltano/lib64/python3.9/site-packages/meltano/cli/utils.py", line 711, in invoke
super().invoke(ctx)
File "/home/ec2-user/.local/share/pipx/venvs/meltano/lib64/python3.9/site-packages/click/core.py", line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/home/ec2-user/.local/share/pipx/venvs/meltano/lib64/python3.9/site-packages/click/core.py", line 783, in invoke
return __callback(*args, **kwargs)
File "/home/ec2-user/.local/share/pipx/venvs/meltano/lib64/python3.9/site-packages/meltano/cli/params.py", line 74, in decorate
return func(*args, **kwargs)
File "/home/ec2-user/.local/share/pipx/venvs/meltano/lib64/python3.9/site-packages/meltano/cli/params.py", line 164, in decorate
func(project, *args, **kwargs)
File "/home/ec2-user/.local/share/pipx/venvs/meltano/lib64/python3.9/site-packages/click/decorators.py", line 33, in new_func
return f(get_current_context(), *args, **kwargs)
File "/home/ec2-user/.local/share/pipx/venvs/meltano/lib64/python3.9/site-packages/meltano/core/utils/__init__.py", line 73, in wrapper
return asyncio.run(func(*args, **kwargs))
File "/usr/lib64/python3.9/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/usr/lib64/python3.9/asyncio/base_events.py", line 647, in run_until_complete
return future.result()
File "/home/ec2-user/.local/share/pipx/venvs/meltano/lib64/python3.9/site-packages/meltano/cli/run.py", line 191, in run
raise err
File "/home/ec2-user/.local/share/pipx/venvs/meltano/lib64/python3.9/site-packages/meltano/cli/run.py", line 188, in run
await _run_blocks(tracker, parsed_blocks, dry_run=dry_run)
File "/home/ec2-user/.local/share/pipx/venvs/meltano/lib64/python3.9/site-packages/meltano/cli/run.py", line 241, in _run_blocks
raise bare_err
File "/home/ec2-user/.local/share/pipx/venvs/meltano/lib64/python3.9/site-packages/meltano/cli/run.py", line 222, in _run_blocks
await blk.run()
File "/home/ec2-user/.local/share/pipx/venvs/meltano/lib64/python3.9/site-packages/meltano/core/block/extract_load.py", line 505, in run
await self.run_with_job()
File "/home/ec2-user/.local/share/pipx/venvs/meltano/lib64/python3.9/site-packages/meltano/core/block/extract_load.py", line 537, in run_with_job
await self.execute()
File "/home/ec2-user/.local/share/pipx/venvs/meltano/lib64/python3.9/site-packages/meltano/core/block/extract_load.py", line 497, in execute
await manager.run()
File "/home/ec2-user/.local/share/pipx/venvs/meltano/lib64/python3.9/site-packages/meltano/core/block/extract_load.py", line 704, in run
await self._wait_for_process_completion(self.elb.head)
File "/home/ec2-user/.local/share/pipx/venvs/meltano/lib64/python3.9/site-packages/meltano/core/block/extract_load.py", line 777, in _wait_for_process_completion
raise output_futures_failed.exception() # noqa: RSE102
File "/home/ec2-user/.local/share/pipx/venvs/meltano/lib64/python3.9/site-packages/meltano/core/logging/utils.py", line 230, in capture_subprocess_output
if not await _write_line_writer(writer, line):
File "/home/ec2-user/.local/share/pipx/venvs/meltano/lib64/python3.9/site-packages/meltano/core/logging/utils.py", line 198, in _write_line_writer
await writer.wait_closed()
File "/usr/lib64/python3.9/asyncio/streams.py", line 359, in wait_closed
await self._protocol._get_close_waiter(self)
File "/home/ec2-user/.local/share/pipx/venvs/meltano/lib64/python3.9/site-packages/meltano/core/logging/utils.py", line 196, in _write_line_writer
await writer.drain()
File "/usr/lib64/python3.9/asyncio/streams.py", line 387, in drain
await self._protocol._drain_helper()
File "/usr/lib64/python3.9/asyncio/streams.py", line 197, in _drain_helper
await waiter
BrokenPipeError
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/ec2-user/.local/share/pipx/venvs/meltano/lib64/python3.9/site-packages/meltano/cli/__init__.py", line 113, in _run_cli
raise CliError(f"{troubleshooting_message}\n{err}") from err # noqa: EM102
meltano.cli.utils.CliError: Need help fixing this problem? Visit <http://melta.no/> for troubleshooting steps, or to
join our friendly Slack community.
Need help fixing this problem? Visit <http://melta.no/> for troubleshooting steps, or to
join our friendly Slack community.
Kyunghwan Choi
08/06/2024, 7:31 PMCharles Feduke
08/06/2024, 7:31 PMKyunghwan Choi
08/06/2024, 7:32 PMKyunghwan Choi
08/06/2024, 7:33 PMCharles Feduke
08/06/2024, 7:35 PMCharles Feduke
08/06/2024, 7:36 PMKyunghwan Choi
08/06/2024, 7:36 PMrun
command with debug log level, and it doesn't seem to give an error related to S3.Charles Feduke
08/06/2024, 7:38 PMfree -h
?Kyunghwan Choi
08/06/2024, 7:39 PMKyunghwan Choi
08/06/2024, 7:39 PMCharles Feduke
08/06/2024, 7:39 PMKyunghwan Choi
08/06/2024, 7:40 PMCharles Feduke
08/06/2024, 7:40 PMCharles Feduke
08/06/2024, 7:40 PMCharles Feduke
08/06/2024, 7:40 PMCharles Feduke
08/06/2024, 7:42 PMCharles Feduke
08/06/2024, 7:42 PMCharles Feduke
08/06/2024, 7:42 PMCharles Feduke
08/06/2024, 7:42 PMKyunghwan Choi
08/06/2024, 7:42 PMKyunghwan Choi
08/06/2024, 7:42 PMKyunghwan Choi
08/06/2024, 7:43 PMCharles Feduke
08/06/2024, 7:43 PMCharles Feduke
08/06/2024, 7:43 PMCharles Feduke
08/06/2024, 7:43 PMKyunghwan Choi
08/06/2024, 7:43 PMCharles Feduke
08/06/2024, 7:44 PMKyunghwan Choi
08/06/2024, 7:44 PMmeltano.db
under .meltano/
directory.Charles Feduke
08/06/2024, 7:44 PMCharles Feduke
08/06/2024, 7:45 PMecho MELTANO_DATABASE_URI
it comes up as an empty string, right?Charles Feduke
08/06/2024, 7:45 PMCharles Feduke
08/06/2024, 7:45 PMecho $MELTANO_DATABASE_URI
(don’t paste results in Slack)Charles Feduke
08/06/2024, 7:46 PMKyunghwan Choi
08/06/2024, 7:48 PMCharles Feduke
08/06/2024, 7:48 PMstate_backend.uri
defined to some value as wellCharles Feduke
08/06/2024, 7:48 PMKyunghwan Choi
08/06/2024, 7:48 PMCharles Feduke
08/06/2024, 7:49 PMCharles Feduke
08/06/2024, 7:49 PMKyunghwan Choi
08/06/2024, 7:49 PMKyunghwan Choi
08/06/2024, 7:50 PMKyunghwan Choi
08/06/2024, 7:50 PMCharles Feduke
08/06/2024, 7:51 PMThe config profile (aws_profile) could not be found
Charles Feduke
08/06/2024, 7:51 PMKyunghwan Choi
08/06/2024, 7:52 PMKyunghwan Choi
08/06/2024, 7:54 PMCharles Feduke
08/06/2024, 7:55 PMCharles Feduke
08/06/2024, 7:55 PMself.write_csv(records)
<http://self.logger.info|self.logger.info>(f'writing {len(records)} records to s3://{self.config["s3_bucket"]}/{self.object}')
self.copy_to_s3()
self.copy_to_redshift(table, cursor)
this is from target_redshift’s sinks.pyKyunghwan Choi
08/06/2024, 7:56 PMKyunghwan Choi
08/06/2024, 7:56 PMKyunghwan Choi
08/06/2024, 7:58 PMCharles Feduke
08/06/2024, 7:58 PMCharles Feduke
08/06/2024, 7:59 PMKyunghwan Choi
08/06/2024, 8:00 PMtemp
folder. I assume that's what it should upload.Charles Feduke
08/06/2024, 8:00 PMCharles Feduke
08/06/2024, 8:01 PMCharles Feduke
08/06/2024, 8:01 PM2024-08-06T19:24:15.414824Z [info ] raise TypeError(f'Object of type {o.__class__.__name__} ' cmd_type=elb consumer=True job_name=staging:tap-hubspot-to-target-redshift name=target-redshift producer=False run_id=d7ca55e2-84c2-4ad7-b724-211055c09ea6 stdio=stderr string_id=target-redshift
2024-08-06T19:24:15.415020Z [info ] TypeError: Object of type Decimal is not JSON serializable cmd_type=elb consumer=True job_name=staging:tap-hubspot-to-target-redshift name=target-redshift producer=False run_id=d7ca55e2-84c2-4ad7-b724-211055c09ea6 stdio=stderr string_id=target-redshift
Charles Feduke
08/06/2024, 8:01 PMCharles Feduke
08/06/2024, 8:02 PM2024-08-06T19:24:15.413077Z [info ] File "/home/ec2-user/eval/.meltano/loaders/target-redshift/venv/lib/python3.9/site-packages/target_redshift/sinks.py", line 215, in <dictcomp> cmd_type=elb consumer=True job_name=staging:tap-hubspot-to-target-redshift name=target-redshift producer=False run_id=d7ca55e2-84c2-4ad7-b724-211055c09ea6 stdio=stderr string_id=target-redshift
Kyunghwan Choi
08/06/2024, 8:02 PMKyunghwan Choi
08/06/2024, 8:02 PMCharles Feduke
08/06/2024, 8:03 PM{key: (json.dumps(value).replace("None", "") if key in object_keys else value) for key, value in record.items()}
Charles Feduke
08/06/2024, 8:03 PMKyunghwan Choi
08/06/2024, 8:06 PMKyunghwan Choi
08/06/2024, 8:07 PMCharles Feduke
08/06/2024, 8:07 PMCharles Feduke
08/06/2024, 8:07 PMCharles Feduke
08/06/2024, 8:08 PMCharles Feduke
08/06/2024, 8:10 PMinfo
-level] line in the log: TypeError: Object of type Decimal is not JSON serializable
Charles Feduke
08/06/2024, 8:14 PM>>> import json
>>> from decimal import Decimal
>>> num = Decimal('3.14')
>>> json.dumps({'xyz': num})
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/Cellar/python@3.12/3.12.4/Frameworks/Python.framework/Versions/3.12/lib/python3.12/json/__init__.py", line 231, in dumps
return _default_encoder.encode(obj)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/Cellar/python@3.12/3.12.4/Frameworks/Python.framework/Versions/3.12/lib/python3.12/json/encoder.py", line 200, in encode
chunks = self.iterencode(o, _one_shot=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/Cellar/python@3.12/3.12.4/Frameworks/Python.framework/Versions/3.12/lib/python3.12/json/encoder.py", line 258, in iterencode
return _iterencode(o, 0)
^^^^^^^^^^^^^^^^^
File "/usr/local/Cellar/python@3.12/3.12.4/Frameworks/Python.framework/Versions/3.12/lib/python3.12/json/encoder.py", line 180, in default
raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type Decimal is not JSON serializable
Charles Feduke
08/06/2024, 8:15 PMdefault=str
is specified it works:
json.dumps({'xyz':num}, default=str)
'{"xyz": "3.14"}'
Charles Feduke
08/06/2024, 8:16 PMKyunghwan Choi
08/06/2024, 8:17 PMCharles Feduke
08/06/2024, 8:18 PMdefault=str
- there must be a reason why its not present (and that reason could be… someone just forgot that Decimal is a type)Kyunghwan Choi
08/06/2024, 8:18 PMCharles Feduke
08/06/2024, 8:18 PMKyunghwan Choi
08/06/2024, 8:19 PMCharles Feduke
08/06/2024, 8:19 PMKyunghwan Choi
08/06/2024, 8:22 PMCharles Feduke
08/06/2024, 8:25 PMKyunghwan Choi
08/06/2024, 8:48 PMKyunghwan Choi
08/07/2024, 5:27 PM