Skip to main content

Streamlit MongoDB Connector: An efficient connector for interfacing MongoDB with Streamlit apps

Project description

Open in Streamlit PyPI Code style: black

Streamlit MongoDB Connector

This repository contains the source code for a MongoDB connector developed for the Streamlit Connections Hackathon.
The goal of this project is to showcase how to leverage the power of Streamlit's new st.connection feature to connect Streamlit applications with MongoDB databases, and use this connection in practical applications.

Installation & Usage

The package can be installed via PyPi.

pip3 install st_mongo_connection

and the following is a simple example to use it

import streamlit as st
from st_mongo_connection import MongoDBConnection

connection = st.connection("mongodb", type=MongoDBConnection)
st.help(connection)
# secrets.toml
[connections.mongodb]
url="mongodb+srv://<username>:<password>@<cluster-name>.<cluster-id>.mongodb.net"
database="database-name"
collection="collection-name"

If you want a real example and a detailed implemetation check out the streamlit app.

Overview

The application is divided into three main sections:

  1. Connection Demonstration: Shows how the connection to MongoDB has been implemented, demonstrating how data can be retrieved and manipulated.

  2. MongoDB Configuration: Demonstrates how to configure the MongoDB connection, explaining how to set it up via the secrets.toml file or directly through the st.connection call.

  3. StreamY: A prototype for a simple text-based social network, where users can post texts on a wall. This showcases the MongoDB connection's use in a practical application, as it's used to store and retrieve posts.

About me

Hello! I'm Moris, a Computer Science Master's graduate with extensive experience in Streamlit and MongoDB. I've developed the MagicLit framework to serve as the base for my company's management app.
I participated in this hackathon to create an optimal component for connecting MongoDB to Streamlit. I hope this project will contribute to the Streamlit community and assist other developers.

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

st_mongo_connection-1.0.3.tar.gz (5.4 kB view hashes)

Uploaded Source

Built Distribution

st_mongo_connection-1.0.3-py3-none-any.whl (5.5 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