Skip to main content

Dask + Trino integration

Project description

dask-trino

This connector is an experimental integration between Dask and Trino. It only works using the spooling protocol introduced in trino version 466.

CI PyPI version

Installation

dask-trino can be installed with pip:

pip install dask-trino

trino configuration

The spooling protocol is currently disabled by default when you deploy trino. The trino docs outline how to enable it.

One extra consideration for the dask-trino connector is the expiry of segments on object storage. By default, when a client acknowledges a segment, the segment is deleted from object storage. We recommend disabling this and letting segments be pruned by trino. This can be achieved by adding this setting to the spooling-manager.properties configuration file:

fs.segment.explicit-ack=false

We recommend this because when working with a dask dataframe, the data may be requested multiple times. If a segment is deleted after the first request, the client will not be able to read from the segment again.

Usage

dask-trino provides read_trino and to_trino methods for parallel IO from trino with Dask.

>>> from dask_trino import read_trino
>>> example_query = '''
...    SELECT *
...    FROM tpch.sf1.customer
... '''
>>> ddf = read_trino(
...     query=example_query,
...     connection_kwargs={
...         "user": "...",
...         "password": "...",
...     },
... )

Note that the to_trino method generates bulk INSERT statements for each partition of the dataframe. There is no other option to do bulk insert of data into trino at this time.

>>> from dask_trino import to_trino
>>> to_trino(
...     ddf,
...     name="my_table",
...     connection_kwargs={
...         "user": "...",
...         "password": "...",
...     },
... )

Project details


Download files

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

Source Distribution

dask_trino-0.2.0.tar.gz (16.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dask_trino-0.2.0-py3-none-any.whl (15.5 kB view details)

Uploaded Python 3

File details

Details for the file dask_trino-0.2.0.tar.gz.

File metadata

  • Download URL: dask_trino-0.2.0.tar.gz
  • Upload date:
  • Size: 16.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for dask_trino-0.2.0.tar.gz
Algorithm Hash digest
SHA256 9e8d4a06d5496ff0015f3f0c06ee365562d7f06165911b3569f2e15cdb073630
MD5 83689c8b85a2e1d037caf2e9809de3e5
BLAKE2b-256 bc2fd869c26fba57fc1a968c3e6c0f5ca126cf630c17bfd871cb80219f0956e3

See more details on using hashes here.

File details

Details for the file dask_trino-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: dask_trino-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 15.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for dask_trino-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 07ef341fa68644e5c6e41afde091d7cd265569ba89c0ef08d7d15557574a4e26
MD5 e02f1a85a709c20774e46e3dcd3bd5a2
BLAKE2b-256 6607f0976567bb84de100886bd7a062694f8bc8f001103037db8f6eb10d5bc6f

See more details on using hashes here.

Supported by

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