airbytehq / airbytehq/PyAirbyte

source-mixpanel raises PyAirbyteNameNormalizationError

Đang mở
#707 4 bình luận 1 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Python
Star
344
Fork
77
Merge trung bình
1 ngày 11 giờ
Pull request đã merge (30 ngày)
35

Mô tả

Opening a ticket per request from @aaronsteers in this [community slack thread](https://airbytehq.slack.com/archives/C06FZ238P8W/p1751321461271109)

I'm running into a PyAirbyteNameNormalizationError when I attempt to run the simple example below.

Example config.json
```json
{
"credentials": {
"project_id": 123,
"secret": "my_secret",
"username": "my_service_account"
},
"start_date": "2025-06-30T21:00:00Z",
"region": "US" #aside: this appears to be required, despite what https://docs.airbyte.com/integrations/sources/mixpanel suggests
}
```

Run this simple example:
```python

import airbyte as ab
from utils import load_json_config

mp_config = load_json_config("starbyte/sources/mixpanel/mixpanel_config.json")
mixpanel_source = ab.get_source(
name="source-mixpanel", config=mp_config, streams=["export"]
)
res = mixpanel_source.read(cache=ab.get_default_cache())

for name, records in res.streams.items():
print(f"Stream {name}: {len(records)} records")
```

Output
```
#From STDOUT
Started reading from source at 15:07:31:

• Read 68,074 records over 6.1 seconds (11,097.3 records/s, 8.33 MB/s).
• Received records for 1 streams:
• 68,074 export
```

```
#FROM LOG
tail -f /tmp/airbyte/logs/source-mixpanel/source-mixpanel-log-JZ1E2HRF0.log
2025-06-30 15:07:32 - INFO - Starting syncing SourceMixpanel
2025-06-30 15:07:32 - INFO - Marking stream export as STARTED
2025-06-30 15:07:32 - INFO - Setting state of SourceMixpanel stream to {}
2025-06-30 15:07:32 - INFO - Syncing stream: export
2025-06-30 15:07:43 - INFO - Marking stream export as RUNNING
```

This raises the following: See the full trace after this block.
```
Exception has occurred: PyAirbyteNameNormalizationError
Name cannot be empty after normalization. (PyAirbyteNameNormalizationError)
------------------------------------------------------------
PyAirbyteNameNormalizationError: Name cannot be empty after normalization.
Raw Name: ''
Normalization Result: ''
KeyError: ''

During handling of the above exception, another exception occurred:

File ".../simple_example.py", line 8, in
res = mixpanel_source.read(cache=ab.get_default_cache())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
airbyte.exceptions.PyAirbyteNameNormalizationError: Name cannot be empty after normalization. (PyAirbyteNameNormalizationError)
------------------------------------------------------------
PyAirbyteNameNormalizationError: Name cannot be empty after normalization.
Raw Name: ''
Normalization Result: '

```

---

```
Traceback (most recent call last):
File ".../.venv/lib/python3.11/site-packages/airbyte/records.py", line 161, in to_index_case
return self.quick_lookup[key]
~~~~~~~~~~~~~~~~~^^^^^
KeyError: ''

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File ".../.local/share/uv/python/cpython-3.11.11-macos-aarch64-none/lib/python3.11/runpy.py", line 198, in _run_module_as_main
return _run_code(code, main_globals, None,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File ".../.local/share/uv/python/cpython-3.11.11-macos-aarch64-none/lib/python3.11/runpy.py", line 88, in _run_code
exec(code, run_globals)
File ".../.vscode/extensions/ms-python.debugpy-2025.11.2025063001-darwin-arm64/bundled/libs/debugpy/adapter/../../debugpy/launcher/../../debugpy/__main__.py", line 71, in
cli.main()
File ".../.vscode/extensions/ms-python.debugpy-2025.11.2025063001-darwin-arm64/bundled/libs/debugpy/adapter/../../debugpy/launcher/../../debugpy/../debugpy/server/cli.py", line 501, in main
run()
File ".../.vscode/extensions/ms-python.debugpy-2025.11.2025063001-darwin-arm64/bundled/libs/debugpy/adapter/../../debugpy/launcher/../../debugpy/../debugpy/server/cli.py", line 351, in run_file
runpy.run_path(target, run_name="__main__")
File ".../.vscode/extensions/ms-python.debugpy-2025.11.2025063001-darwin-arm64/bundled/libs/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 310, in run_path
return _run_module_code(code, init_globals, run_name, pkg_name=pkg_name, script_name=fname)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File ".../.vscode/extensions/ms-python.debugpy-2025.11.2025063001-darwin-arm64/bundled/libs/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 127, in _run_module_code
_run_code(code, mod_globals, init_globals, mod_name, mod_spec, pkg_name, script_name)
File ".../.vscode/extensions/ms-python.debugpy-2025.11.2025063001-darwin-arm64/bundled/libs/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 118, in _run_code
exec(code, run_globals)
File ".../simple_example.py", line 8, in
res = mixpanel_source.read(cache=ab.get_default_cache())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File ".../.venv/lib/python3.11/site-packages/airbyte/sources/base.py", line 762, in read
result = self._read_to_cache(
^^^^^^^^^^^^^^^^^^^^
File ".../.venv/lib/python3.11/site-packages/airbyte/sources/base.py", line 846, in _read_to_cache
cache._write_airbyte_message_stream( # noqa: SLF001 # Non-public API
File ".../.venv/lib/python3.11/site-packages/airbyte/caches/base.py", line 362, in _write_airbyte_message_stream
cache_processor.process_airbyte_messages(
File ".../.venv/lib/python3.11/site-packages/airbyte/shared/sql_processor.py", line 282, in process_airbyte_messages
self.process_record_message(
File ".../.venv/lib/python3.11/site-packages/airbyte/shared/sql_processor.py", line 436, in process_record_message
self.file_writer.process_record_message(
File ".../.venv/lib/python3.11/site-packages/airbyte/_writers/file_writers.py", line 194, in process_record_message
record_dict=StreamRecord.from_record_message(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File ".../.venv/lib/python3.11/site-packages/airbyte/records.py", line 250, in from_record_message
return cls(
^^^^
File ".../.venv/lib/python3.11/site-packages/airbyte/records.py", line 223, in __init__
{
File ".../.venv/lib/python3.11/site-packages/airbyte/records.py", line 226, in
if self._stream_handler.to_index_case(k) in self._stream_handler.index_keys
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File ".../.venv/lib/python3.11/site-packages/airbyte/records.py", line 164, in to_index_case
self._normalizer.normalize(key)
File ".../.venv/lib/python3.11/site-packages/airbyte/_util/name_normalizers.py", line 81, in normalize
raise exc.PyAirbyteNameNormalizationError(
airbyte.exceptions.PyAirbyteNameNormalizationError: Name cannot be empty after normalization. (PyAirbyteNameNormalizationError)
------------------------------------------------------------
PyAirbyteNameNormalizationError: Name cannot be empty after normalization.
Raw Name: ''
Normalization Result: ''
```

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.