Skip to main content

Dask + Mongo intergration

Project description

Dask-Mongo

Tests Linting

Read and write data to MongoDB with Dask

Installation

You can install dask-mongo from PyPI

pip install 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

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-mongo-2021.7.3.tar.gz (5.6 kB view details)

Uploaded Source

Built Distribution

dask_mongo-2021.7.3-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

Details for the file dask-mongo-2021.7.3.tar.gz.

File metadata

  • Download URL: dask-mongo-2021.7.3.tar.gz
  • Upload date:
  • Size: 5.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.6

File hashes

Hashes for dask-mongo-2021.7.3.tar.gz
Algorithm Hash digest
SHA256 17d93e7e3f82f9f70cb0994e118b8e8c473bca99c63f1b4278bc91ba971afdc9
MD5 03e77271dbe2ed1d252536e980ac11ba
BLAKE2b-256 ed993cdf1fdff6bab89fe23cc8714cad6102a1c58e67ab0bd7b6f7baf0858b91

See more details on using hashes here.

Provenance

File details

Details for the file dask_mongo-2021.7.3-py3-none-any.whl.

File metadata

  • Download URL: dask_mongo-2021.7.3-py3-none-any.whl
  • Upload date:
  • Size: 5.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.6

File hashes

Hashes for dask_mongo-2021.7.3-py3-none-any.whl
Algorithm Hash digest
SHA256 5d1b7fa75833585f7f42838314209fd70efc99ad577578c1d9ec59d04b93ef6d
MD5 26478255b27912441ff646e23b928a3f
BLAKE2b-256 8a251e259da040307f10962b9bccd5c0bbf33e6fc5b2a509b3b454361ca8dd1c

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