Update app.py
Browse files
app.py
CHANGED
@@ -21,6 +21,7 @@ from streamlit_extras.stylable_container import stylable_container
|
|
21 |
from streamlit_extras.stateful_button import button
|
22 |
import json
|
23 |
from io import BytesIO
|
|
|
24 |
# ######
|
25 |
# import os
|
26 |
# import subprocess
|
@@ -165,11 +166,13 @@ with selectcol12:
|
|
165 |
select2=st.selectbox('SOURCE SCHEMA NAME',('DBO','CLIENT'),key='SCHname',index=None,placeholder='Select schema name', on_change=clear_cache)
|
166 |
if select1 =='DB_10001' and select2 is not None:
|
167 |
with st.spinner("Loading Tables:"):
|
168 |
-
|
169 |
-
|
170 |
"Database=sqldb-ext-dev-uks-001;"
|
171 |
"UID=dbadmin;"
|
172 |
"PWD=mYpa$$w0rD" )
|
|
|
|
|
173 |
|
174 |
query0_1=f"select * from INFORMATION_SCHEMA.TABLES where TABLE_SCHEMA='{select2}' ORDER BY TABLE_NAME ASC"
|
175 |
st.session_state.tab_names_init=list(pd.read_sql_query(query0_1,con=conn1)['TABLE_NAME'])
|
@@ -226,11 +229,13 @@ if select1 =='DB_10001' and select2 is not None:
|
|
226 |
with st.container(height= 400, border=True):
|
227 |
cole1,cole2=st.columns([1,1.5])
|
228 |
with cole1:
|
229 |
-
|
230 |
"Server=sql-ext-dev-uks-001.database.windows.net;"
|
231 |
"Database=sqldb-ext-dev-uks-001;"
|
232 |
"UID=dbadmin;"
|
233 |
"PWD=mYpa$$w0rD" )
|
|
|
|
|
234 |
table_selector= tab_names_shown[i]
|
235 |
if table_selector is not None:
|
236 |
query2="select "+count+" * from [dbo].["+table_selector+"]"
|
|
|
21 |
from streamlit_extras.stateful_button import button
|
22 |
import json
|
23 |
from io import BytesIO
|
24 |
+
import mssql_datapy as msdp
|
25 |
# ######
|
26 |
# import os
|
27 |
# import subprocess
|
|
|
166 |
select2=st.selectbox('SOURCE SCHEMA NAME',('DBO','CLIENT'),key='SCHname',index=None,placeholder='Select schema name', on_change=clear_cache)
|
167 |
if select1 =='DB_10001' and select2 is not None:
|
168 |
with st.spinner("Loading Tables:"):
|
169 |
+
|
170 |
+
conn1_str = msdp.get_connection_string("Server=sql-ext-dev-uks-001.database.windows.net;"
|
171 |
"Database=sqldb-ext-dev-uks-001;"
|
172 |
"UID=dbadmin;"
|
173 |
"PWD=mYpa$$w0rD" )
|
174 |
+
# Establish connection
|
175 |
+
conn1 = msdp.connect(conn1_str)
|
176 |
|
177 |
query0_1=f"select * from INFORMATION_SCHEMA.TABLES where TABLE_SCHEMA='{select2}' ORDER BY TABLE_NAME ASC"
|
178 |
st.session_state.tab_names_init=list(pd.read_sql_query(query0_1,con=conn1)['TABLE_NAME'])
|
|
|
229 |
with st.container(height= 400, border=True):
|
230 |
cole1,cole2=st.columns([1,1.5])
|
231 |
with cole1:
|
232 |
+
conn_str = msdp.get_connection_string("Driver={ODBC Driver 17 for SQL Server};"
|
233 |
"Server=sql-ext-dev-uks-001.database.windows.net;"
|
234 |
"Database=sqldb-ext-dev-uks-001;"
|
235 |
"UID=dbadmin;"
|
236 |
"PWD=mYpa$$w0rD" )
|
237 |
+
# Establish connection
|
238 |
+
conn = msdp.connect(conn_str)
|
239 |
table_selector= tab_names_shown[i]
|
240 |
if table_selector is not None:
|
241 |
query2="select "+count+" * from [dbo].["+table_selector+"]"
|