Skip to content

Conversation

@akkik04
Copy link
Contributor

@akkik04 akkik04 commented Dec 22, 2025

Summary

This PR addresses #605.

Specifically:

  • pa.date32() is now mapped to Date32
  • pa.date64() is mapped to DateTime64(3) (preserving millisecond precision)
  • pa.timestamp('s', tz=None)DateTime
  • pa.timestamp('s', tz='TZ')DateTime('TZ')
  • pa.timestamp('ms', tz=None)DateTime64(3)
  • pa.timestamp('us', tz=None)DateTime64(6)
  • pa.timestamp('ns', tz=None)DateTime64(9)
  • pa.timestamp('ms', tz='TZ')DateTime64(3, 'TZ'), etc.

Checklist

Delete items not relevant to your PR:

  • Unit and integration tests covering the common scenarios were added
  • A human-readable description of the changes was provided to include in CHANGELOG
  • For significant changes, documentation in https://github.com/ClickHouse/clickhouse-docs was updated with further explanations or tutorials

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR extends PyArrow-to-ClickHouse table creation support to handle datetime, date, and timestamp types, addressing issue #605. Previously, these types would raise unsupported type errors.

Key changes:

  • Added mappings for PyArrow date32, date64, and timestamp types to corresponding ClickHouse DateTime/Date types
  • Preserves precision and timezone information when converting timestamp types
  • Updated tests to verify datetime type conversion and remove outdated unsupported type checks

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
clickhouse_connect/driver/ddl.py Implements datetime/timestamp type mappings in _arrow_type_to_ch function with precision and timezone handling
tests/unit_tests/test_pyarrow_ddl.py Adds comprehensive unit tests for datetime type mappings and updates unsupported type test to use list type instead of timestamp
tests/integration_tests/test_pyarrow_ddl_integration.py Adds end-to-end integration test validating datetime table creation and data insertion
CHANGELOG.md Documents the new datetime/timestamp support feature

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

@joe-clickhouse joe-clickhouse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@joe-clickhouse joe-clickhouse merged commit b4ba130 into ClickHouse:main Jan 5, 2026
35 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants