File size: 437 Bytes
24e0e93
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import streamlit as st
from pymongo import MongoClient
import os

@st.cache_resource
def init_conn():
    uri = os.getenv('MONGO_URI')
    if not uri:
        uri = st.secrets['mongo_uri']
    client = MongoClient(uri, retryWrites=True, serverSelectionTimeoutMS=100000)
    dfs_db = client["NFL_Database"]
    props_db = client["Props_DB"]

    return props_db, dfs_db

# Initialize the database connection
props_db, dfs_db = init_conn()