Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 6, 2026

Describe your changes:

Clickhouse ingestion fails when tables contain IPv4 or IPv6 columns. The clickhouse-sqlalchemy driver returns Python ipaddress.IPv4Address and ipaddress.IPv6Address objects which cannot be JSON-serialized by Pydantic, causing the error:

Unable to serialize unknown type: <class 'ipaddress.IPv4Address'>

Changes:

  • Extended ingest_table_sample_data() in table_mixin.py to convert IP address objects to strings before serialization
  • Added comprehensive unit tests covering IPv4, IPv6, mixed types, and edge cases

Implementation:

# Handle IPv4 and IPv6 address objects
elif isinstance(value, (ipaddress.IPv4Address, ipaddress.IPv6Address)):
    row[col_idx] = str(value)

This follows the existing pattern for handling bytes types and extends support to IP address objects returned by Clickhouse.

Type of change:

  • Bug fix

Checklist:

  • I have read the CONTRIBUTING document.
  • My PR title is Fixes <issue-number>: <short explanation>
  • I have commented on my code, particularly in hard-to-understand areas.
  • For JSON Schema changes: I updated the migration scripts or explained why it is not needed.
  • I have added a test that covers the exact scenario we are fixing. For complex issues, comment the issue number in the test for future reference.
Original prompt

This section details on the original issue you should resolve

<issue_title>Clickhouse Ingestion -</issue_title>
<issue_description>Affected module
Ingestion Framework

Describe the bug
Ingesting table with IPv4 column returns an error

[2025-02-14T07:34:30.735+0000] {table_mixin.py:76} WARNING - Error trying to PUT sample data for "dbname.tablename".default.dbname.tablename: Unable to serialize unknown type: <class 'ipaddress.IPv4Address'>

** Steps to Reproduce**
Start Clickhouse ingestion process

Expected behavior
A clear and concise description of what you expected to happen.

Version:

  • OS: Linux
  • Python version:
  • OpenMetadata version: 1.6.1 (running docker-compose-postgres.yml version)
  • OpenMetadata Ingestion package version: docker-compose-postgres version

Additional context
Found this resolved issue, Clickhouse probably added some new type since then</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.


Summary by Gitar

  • Fixed serialization error:
    • Added handling for ipaddress.IPv4Address and ipaddress.IPv6Address types in table_mixin.py:94-97
    • Converts IP address objects to strings before JSON serialization
  • New test file:
    • test_table_mixin.py with 5 unit tests covering IPv4, IPv6, mixed types, None values, and error handling

This will update automatically on new commits.


Copilot AI and others added 2 commits January 6, 2026 13:05
- Added import for ipaddress module
- Extended ingest_table_sample_data to handle IPv4Address and IPv6Address objects
- Convert IP address objects to strings before JSON serialization
- Added comprehensive unit tests for the fix

Co-authored-by: ulixius9 <39544459+ulixius9@users.noreply.github.com>
Co-authored-by: ulixius9 <39544459+ulixius9@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix ingestion error with IPv4 column in Clickhouse Fix Clickhouse IPv4/IPv6 address serialization in sample data ingestion Jan 6, 2026
Copilot AI requested a review from ulixius9 January 6, 2026 13:11
@pmbrull pmbrull added the safe to test Add this label to run secure Github workflows on PRs label Jan 9, 2026
@gitar-bot
Copy link

gitar-bot bot commented Jan 9, 2026

Code Review ✅ Approved

Clean bug fix that adds IPv4/IPv6 address serialization support following existing patterns, with comprehensive test coverage.

What Works Well

The fix follows the established pattern for handling special types (similar to bytes handling). Comprehensive test coverage including IPv4, IPv6, mixed types, None values, and error handling scenarios.

Options

Auto-apply is off Gitar will not commit updates to this branch.
Display: compact Hiding non-applicable rules.

Comment with these commands to change:

Auto-apply Compact
gitar auto-apply:on         
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | This comment will update automatically (Docs)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

safe to test Add this label to run secure Github workflows on PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Clickhouse Ingestion -

3 participants