Skip to main content

Python binding for delta-rs

Project description

Deltalake-python

PyPI

Native Delta Lake binding for Python based on delta-rs.

Installation

pip install deltalake

NOTE: official binary wheels are linked against openssl statically for remote objection store communication. Please file Github issue to request for critical openssl upgrade.

Usage

Resolve partitions for current version of the DeltaTable:

>>> from deltalake import DeltaTable
>>> dt = DeltaTable("../rust/tests/data/delta-0.2.0")
>>> dt.version()
3
>>> dt.files()
['part-00000-cb6b150b-30b8-4662-ad28-ff32ddab96d2-c000.snappy.parquet', 'part-00000-7c2deba3-1994-4fb8-bc07-d46c948aa415-c000.snappy.parquet', 'part-00001-c373a5bd-85f0-4758-815e-7eb62007a15c-c000.snappy.parquet']

Convert DeltaTable into PyArrow Table and Pandas Dataframe:

>>> from deltalake import DeltaTable
>>> dt = DeltaTable("../rust/tests/data/simple_table")
>>> df = dt.to_pyarrow_table().to_pandas()
>>> df
   id
0   5
1   7
2   9
>>> df[df['id'] > 5]
   id
1   7
2   9

Time travel:

>>> from deltalake import DeltaTable
>>> dt = DeltaTable("../rust/tests/data/simple_table")
>>> dt.load_version(2)
>>> dt.to_pyarrow_table().to_pandas()
   id
0   5
1   7
2   9
3   5
4   6
5   7
6   8
7   9

Schema:

>>> from deltalake import DeltaTable
>>> dt = DeltaTable("../rust/tests/data/simple_table")
>>> dt.schema()
Schema(Field(id: DataType(long) nullable(True) metadata({})))
>>> dt.pyarrow_schema()
id: int64

Develop

maturin is used to build the python package.

To install development version of the package into your current Python environment:

$ maturin develop

Code are formatted with https://github.com/psf/black.

Build manylinux wheels

docker run -e PKG_CONFIG_PATH=/usr/local/lib64/pkgconfig -it -v `pwd`:/io apache/arrow-dev:amd64-centos-6.10-python-manylinux2010 bash
curl https://sh.rustup.rs -sSf | sh -s -- -y
source $HOME/.cargo/env
rustup default stable
cargo install --git https://github.com/PyO3/maturin.git --rev 98636cea89c328b3eba4ebb548124f75c8018200 maturin
cd /io/python
export PATH=/opt/python/cp37-cp37m/bin:/opt/python/cp38-cp38/bin:$PATH
maturin publish -b pyo3 --target x86_64-unknown-linux-gnu --no-sdist

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

deltalake-0.4.1-cp36-abi3-win_amd64.whl (5.0 MB view details)

Uploaded CPython 3.6+ Windows x86-64

deltalake-0.4.1-cp36-abi3-manylinux2010_x86_64.whl (6.7 MB view details)

Uploaded CPython 3.6+ manylinux: glibc 2.12+ x86-64

deltalake-0.4.1-cp36-abi3-macosx_10_7_x86_64.whl (5.1 MB view details)

Uploaded CPython 3.6+ macOS 10.7+ x86-64

File details

Details for the file deltalake-0.4.1-cp36-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for deltalake-0.4.1-cp36-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 bce5c6c74adc332b34f6f678681c7a2294f2c1949b53029c0359bda40faefae3
MD5 b14c726a3addc9a42e8af123a83c614e
BLAKE2b-256 ccd977883b94fa5b873aac7423ce07bd7c92c6a70aa47edcf83d18fb29cda0fc

See more details on using hashes here.

Provenance

File details

Details for the file deltalake-0.4.1-cp36-abi3-manylinux2010_x86_64.whl.

File metadata

File hashes

Hashes for deltalake-0.4.1-cp36-abi3-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 cb1d0df8c373d69ee593e1a9ff8414ce17f4ac7a9ff2e240c2421e7b3a375df9
MD5 c30b0f7c69043c6834ad150170b46de3
BLAKE2b-256 e920301650c8d66597f4cf7559bc7da565d83d8380f3afebedb129941a9c202b

See more details on using hashes here.

Provenance

File details

Details for the file deltalake-0.4.1-cp36-abi3-macosx_10_7_x86_64.whl.

File metadata

File hashes

Hashes for deltalake-0.4.1-cp36-abi3-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 4754068ffb64b1ecf68e6238fc0fb4971f386cbe1cb4c43949da3ad294f14a66
MD5 6fe2fcdaa59d1f8c584ddb23b15196f2
BLAKE2b-256 2f2ae5c01fd574e6c08ede6ed7d4090a031506cc57cd5cd5eb099c867c88bc47

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page