Skip to content

Add chdb.datastore shim and fix chdb.__version__#535

Merged
auxten merged 3 commits into
mainfrom
feat/chdb-datastore-shim
Mar 10, 2026
Merged

Add chdb.datastore shim and fix chdb.__version__#535
auxten merged 3 commits into
mainfrom
feat/chdb-datastore-shim

Conversation

@auxten

@auxten auxten commented Mar 10, 2026

Copy link
Copy Markdown
Member

Summary

  • Add chdb/datastore.py shim so from chdb import datastore as pd works after chdb / chdb-core split
  • Dynamically patch chdb.__version__ to the chdb pip-package version (instead of chdb-core's engine version)
  • Expose chdb.core_version — the chdb-core pip-package version (via importlib.metadata)
  • Update pyproject.toml to include chdb as a namespace package (namespaces = true)

How it works

The shim chdb/datastore.py is installed into site-packages/chdb/ alongside chdb-core's files. On import it:

  1. Reads chdb-core pip-package version → chdb.core_version
  2. Patches chdb.__version__ / chdb.chdb_version from the chdb pip-package metadata
  3. Replaces itself in sys.modules with the real top-level datastore package

After import:

import chdb.datastore as pd

chdb.__version__      # chdb pip-package version, e.g. "3.7.0"
chdb.core_version     # chdb-core pip-package version, e.g. "26.1.0"
chdb.engine_version   # ClickHouse engine version, e.g. "26.1.2.1"

Test plan

  • from chdb import datastore as pd — works, all public API accessible
  • import chdb.datastore as pd — works
  • chdb.__version__ shows chdb pip-package version
  • chdb.core_version shows chdb-core pip-package version
  • chdb.engine_version unchanged (ClickHouse engine version)
  • No double-patching when both code paths trigger

…dating pyproject.toml. The new datastore.py module allows seamless import from chdb, while the pyproject.toml file now includes the chdb package in the setuptools configuration.
@auxten auxten changed the title feat: add chdb.datastore shim and fix chdb.__version__ Add chdb.datastore shim and fix chdb.__version__ Mar 10, 2026
auxten added 2 commits March 10, 2026 10:30
…metadata for consistency. This change ensures that the core version is retrieved directly from the package metadata, improving reliability and maintainability.
…s. Update related tests to reflect this change, ensuring consistency in timing representation across the datastore modules.
@auxten auxten merged commit 9cd0218 into main Mar 10, 2026
6 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.

1 participant