-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathdirCheck.py
More file actions
31 lines (24 loc) · 945 Bytes
/
dirCheck.py
File metadata and controls
31 lines (24 loc) · 945 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import os
import streamlit as st
import json
workdir = os.getcwd()
#print (workdir)
conndir = workdir + '/.streamlit/'
#print(conndir)
connfile = conndir + 'cred.json'
print(connfile)
# Create Session object
def create_session():
if "snowpark_session" not in st.session_state:
connection_parameters = json.load(open(conndir + 'cred.json'))
connection_parameters['database'] = 'ENVIRONMENT_DATA_ATLAS'
connection_parameters['schema'] = 'ENVIRONMENT'
session = session.builder.configs(connection_parameters).create()
st.session_state['snowpark_session'] = session
else:
session = st.session_state['snowpark_session']
return session
print(session.sql('select current_warehouse(), current_database(), current_schema()').collect())
#return session
st_session = create_session()
#print(session.sql('select current_warehouse(), current_database(), current_schema()').collect())