File size: 799 Bytes
d323d4b
 
 
 
 
 
 
 
 
 
 
20b763c
68a1d9b
ef81816
 
 
548fe2e
68a1d9b
d323d4b
68a1d9b
d323d4b
68a1d9b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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)
        salaries_db = client['Contest_Information']
        nfl_db = client["NFL_Database"]
        nba_db = client["NBA_Database"]
        mlb_db = client["MLB_Database"]
        nhl_db = client["NHL_Database"]
        mma_db = client["MMA_Database"]
        pga_db = client["PGA_Database"]

        return nfl_db, salaries_db, nba_db, mlb_db, nhl_db, mma_db, pga_db
    
nfl_db, salaries_db, nba_db, mlb_db, nhl_db, mma_db, pga_db = init_conn()