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

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: dask-mongo-2021.7.2.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.2.tar.gz
Algorithm Hash digest
SHA256 654e94e9e94b8ba03d2fb48d0231cd90b60f0081935fff1406e8fee9f2baba8d
MD5 8dbacf4cf9eaa936b2ee070988706925
BLAKE2b-256 19f50d0b2ffb2ed482bd2762c8ddf7fd5872a1a5c39b329251ec3518e4573b4c

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: dask_mongo-2021.7.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 7a93b671f4401b0168a19107cbf454fb94bb46f421b5efbf9e770640af1c74e8
MD5 20855c75ea1e50b37b1950c2e47c68ff
BLAKE2b-256 4a2b923be2ba88af244a4d42316c6c9fdbb7ae2d5fee996ec6bcde95839bc5b3

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