File tree 1 file changed +24
-0
lines changed
1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change
1
+ These Streamlit snippets illustrate how to establish experimental connections and create a custom connection class:
2
+
3
+ ** Establishing connections:**
4
+
5
+ st.experimental_connection('pets_db', type='sql')
6
+ sets up an experimental connection named 'pets_db' of type SQL.
7
+
8
+ conn = st.experimental_connection('sql')
9
+ retrieves the experimental SQL connection.
10
+
11
+ conn = st.experimental_connection('snowpark')
12
+ retrieves the experimental Snowpark connection.
13
+
14
+ ** Creating a custom connection class:**
15
+
16
+ The code defines a custom connection class ` MyConnection ` inheriting from ` ExperimentalBaseConnection[myconn.MyConnection] ` .
17
+
18
+ _connect()
19
+ method establishes a connection using custom parameters and returns an instance of ` MyConnection ` .
20
+
21
+ query()
22
+ method executes a query using the connection instance.
23
+
24
+ This code demonstrates Streamlit's experimental features for establishing and customizing connections to databases and other data sources.
You can’t perform that action at this time.
0 commit comments