Skip to main content

Dask-Mongo

Tests Linting

Read and write data to MongoDB with Dask

Installation

dask-mongo can be installed with pip:

pip install dask-mongo

or with conda:

conda install -c conda-forge dask-mongo

Example

import dask.bag as db
import dask_mongo

# Create Dask Bag
records = [
    {"name": "Alice", "fruit": "apricots"},
    {"name": "Bob", "fruit": ["apricots", "cherries"]},
    {"name": "John", "age": 17, "sports": "cycling"},
]

b = db.from_sequence(records)

# Write to a Mongo database
dask_mongo.to_mongo(
    b,
    database="your_database",
    collection="your_collection",
    connection_kwargs={"host": "localhost", "port": 27017},
)

# Read Dask Bag from Mongo database
b = dask_mongo.read_mongo(
    database="your_database",
    collection="your_collection",
    connection_kwargs={"host": "localhost", "port": 27017},
    chunksize=2,
)

# Perform normal operations with Dask
names = b.pluck("name").compute()
assert names == ["Alice", "Bob", "John"]

License

BSD-3

Metadata

Release files for dask-mongo 2022.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dask-mongo 2022.5.0
File Size Uploaded
dask-mongo-2022.5.0.tar.gz 5.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for dask-mongo 2022.5.0
File Interpreter ABI Platform
dask_mongo-2022.5.0-py3-none-any.whl Python 3 none any Details

Total release size: 11.9 kB

Release files / dask-mongo-2022.5.0.tar.gz

Download URL dask-mongo-2022.5.0.tar.gz
Size 5.7 kB
Tags Source
SHA-256 checksum
How to use checksums
a50dc71afa5d809e7501f135d1a5b7976f16625d0bbf5f416136ae8c46eef575
BLAKE2b-256 checksum
How to use checksums
e13b511797f289e5778587b34389f928f6f93e024edacd353555380bd76c2581
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.9.6

Release files / dask_mongo-2022.5.0-py3-none-any.whl

Download URL dask_mongo-2022.5.0-py3-none-any.whl
Size 6.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7ea5a9525e15592e9fa87980661fbe1bcffc9c49c899bdffc9f7cbf1ea8fbee0
BLAKE2b-256 checksum
How to use checksums
569978481ee23c89bf9c18beb4dbfc675b238f16cf7eb3f064fc258b97006556
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.9.6

Release history Release notifications | RSS feed

This release

2022.5.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page