Skip to content

Instantly share code, notes, and snippets.

@nickolasclarke
Last active June 30, 2025 22:19
Show Gist options
  • Save nickolasclarke/dd858ea3b4464e472f5a02ffbd4ce586 to your computer and use it in GitHub Desktop.
Save nickolasclarke/dd858ea3b4464e472f5a02ffbd4ce586 to your computer and use it in GitHub Desktop.

Example config.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:

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 <module>
    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 <module>
   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 <module>
   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 <dictcomp>
   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: ''
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment