Error running dlt pipeline to send loaded table query result to s3!
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1971, in _exec_single_context
    self.dialect.do_execute(
  File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/default.py", line 919, in do_execute
    cursor.execute(statement, parameters)
  File "/usr/local/lib/python3.10/site-packages/duckdb_engine/__init__.py", line 139, in execute
    self.__c.execute(statement, parameters)
duckdb.duckdb.InvalidInputException: Invalid Input Error: No magic bytes found at end of file 's3://faircrest-health-system/pipelines/test_datafabric_93f21f0e_1a56_405a_a767_03470e7cbbba/staging/test_extract_datafabric/extract-05-06-2025-07-30.csv'

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

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.10/site-packages/dlt/extract/utils.py", line 235, in _parallel_gen
    return next(gen)  # type: ignore[call-overload]
  File "/app/app/dlt_sources.py", line 69, in query_resource
    conn.execute(text(statement))
  File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1422, in execute
    return meth(
  File "/usr/local/lib/python3.10/site-packages/sqlalchemy/sql/elements.py", line 514, in _execute_on_connection
    return connection._execute_clauseelement(
  File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1644, in _execute_clauseelement
    ret = self._execute_context(
  File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1850, in _execute_context
    return self._exec_single_context(
  File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1990, in _exec_single_context
    self._handle_dbapi_exception(
  File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 2357, in _handle_dbapi_exception
    raise sqlalchemy_exception.with_traceback(exc_info[2]) from e
  File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1971, in _exec_single_context
    self.dialect.do_execute(
  File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/default.py", line 919, in do_execute
    cursor.execute(statement, parameters)
  File "/usr/local/lib/python3.10/site-packages/duckdb_engine/__init__.py", line 139, in execute
    self.__c.execute(statement, parameters)
sqlalchemy.exc.ProgrammingError: (duckdb.duckdb.InvalidInputException) Invalid Input Error: No magic bytes found at end of file 's3://faircrest-health-system/pipelines/test_datafabric_93f21f0e_1a56_405a_a767_03470e7cbbba/staging/test_extract_datafabric/extract-05-06-2025-07-30.csv'
[SQL: CREATE OR REPLACE VIEW pipeline_test_extract_datafabric AS SELECT * FROM read_parquet('s3://faircrest-health-system/pipelines/test_datafabric_93f21f0e_1a56_405a_a767_03470e7cbbba/staging/test_extract_datafabric/extract-05-06-2025-07-30.csv');]
(Background on this error at: https://sqlalche.me/e/20/f405)

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

Traceback (most recent call last):
  File "/app/app/data_pipeline.py", line 1098, in run_pipeline
    metadata, dlt_source = await get_metadata(dlt_source)
  File "/app/app/pipeline_utils.py", line 655, in get_metadata
    table = next(iter(obj))
  File "/usr/local/lib/python3.10/site-packages/dlt/common/utils.py", line 146, in flatten_list_or_items
    for items in _iter:
  File "/usr/local/lib/python3.10/site-packages/dlt/extract/pipe_iterator.py", line 378, in __next__
    item = super().__next__()
  File "/usr/local/lib/python3.10/site-packages/dlt/extract/pipe_iterator.py", line 163, in __next__
    pipe_item = self._futures_pool.resolve_next_future(
  File "/usr/local/lib/python3.10/site-packages/dlt/extract/concurrency.py", line 182, in resolve_next_future
    return self._resolve_future(future)
  File "/usr/local/lib/python3.10/site-packages/dlt/extract/concurrency.py", line 142, in _resolve_future
    raise ResourceExtractionError(pipe.name, future, str(ex), "future") from ex
dlt.extract.exceptions.ResourceExtractionError: In processing pipe test_datafabric: extraction of resource test_datafabric in future <Future at 0x7d041a3c0ca0 state=finished raised ProgrammingError> caused an exception: (duckdb.duckdb.InvalidInputException) Invalid Input Error: No magic bytes found at end of file 's3://faircrest-health-system/pipelines/test_datafabric_93f21f0e_1a56_405a_a767_03470e7cbbba/staging/test_extract_datafabric/extract-05-06-2025-07-30.csv'
[SQL: CREATE OR REPLACE VIEW pipeline_test_extract_datafabric AS SELECT * FROM read_parquet('s3://faircrest-health-system/pipelines/test_datafabric_93f21f0e_1a56_405a_a767_03470e7cbbba/staging/test_extract_datafabric/extract-05-06-2025-07-30.csv');]
(Background on this error at: https://sqlalche.me/e/20/f405)