James McCool
Rename database from 'NBA_DFS' to 'NBA_Database' for clarity and consistency
04419ae
raw
history blame contribute delete
484 Bytes
import streamlit as st
import pymongo
import os
@st.cache_resource
def init_conn():
# Try to get from environment variable first, fall back to secrets
uri = os.getenv('MONGO_URI')
if not uri:
uri = st.secrets['mongo_uri']
client = pymongo.MongoClient(uri, retryWrites=True, serverSelectionTimeoutMS=500000)
db = client["NBA_Database"]
wnba_db = client["WNBA_DFS"]
return db, wnba_db
db, wnba_db = init_conn()