|
|
import streamlit as st |
|
|
import pymongo |
|
|
import os |
|
|
|
|
|
@st.cache_resource |
|
|
def init_conn(): |
|
|
|
|
|
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() |