Skip to main content

The dconnector Python package provides a streamlined interface for connecting to MongoDB databases using the MongoDBConnection class in Streamlit Projects. This class encapsulates common MongoDB operations, such as querying, inserting, updating, and deleting documents, and provides a convenient way to interact with MongoDB collections using pandas DataFrames.

Project description

The dconnector Python package facilitates MongoDB database interactions through the MongoDBConnection class. This class extends streamlit.connections.ExperimentalBaseConnection and integrates with the pymongo library to offer a comprehensive set of functionalities for working with MongoDB collections. Users can establish connections by specifying the MongoDB connection string, database name, and collection name, either through explicit parameters or by relying on stored secrets.

The provided methods cover a wide range of MongoDB operations, including querying documents based on filters, retrieving all documents, finding a single document, and executing custom queries. The package supports caching mechanisms to enhance performance, allowing users to set time-to-live values for cached results.

In addition to query operations, the MongoDBConnection class supports document insertion, either for a single document or multiple documents in a batch. Users can also update and delete documents based on specified queries. The class further provides methods for counting documents, retrieving distinct values for a given field, and paginating through the collection.

To ensure flexibility, the class exposes several optional keyword arguments for each operation, allowing users to customize their MongoDB queries. The pandas library is leveraged to convert query results into easily manipulable DataFrames, simplifying data analysis and manipulation tasks.

This package aims to streamline MongoDB interactions within Python applications, offering an abstraction layer that balances ease of use with robust functionality.

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

dconnector-0.1.0.tar.gz (3.8 kB view hashes)

Uploaded Source

Built Distribution

dconnector-0.1.0-py3-none-any.whl (4.1 kB view hashes)

Uploaded Python 3

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