Can anyone provide support on streamlit connectivity with databricks delta table/sql end point
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-27-2023 08:59 AM
Can anyone provide support on streamlit connectivity with databricks delta table/sql end point
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-28-2023 10:40 AM
@ananthakrishna raikar :
Certainly! Streamlit can be used to connect to Databricks Delta tables and SQL endpoints through the use of the Databricks SQL Endpoint JDBC/ODBC driver.
Here's a sample code snippet to connect Streamlit with Databricks Delta:
import streamlit as st
import pandas as pd
import sqlalchemy
# Set up a connection to the Databricks SQL Endpoint using SQLAlchemy
# Replace with your own values for the JDBC/ODBC driver and endpoint URL
engine = sqlalchemy.create_engine("databricks+odbc://<Driver Name>:<Host Name>:<Port Number>?Authentication=<Auth Type>")
# Define a function to execute SQL queries and return the results as a Pandas dataframe
def run_query(query):
with engine.connect() as con:
rs = con.execute(query)
df = pd.DataFrame(rs.fetchall(), columns=rs.keys())
return df
# Example query to retrieve data from a Delta table
query = "SELECT * FROM my_delta_table"
# Call the function to execute the query and display the results in Streamlit
result_df = run_query(query)
st.dataframe(result_df)
Make sure to replace the values in the engine variable with your own JDBC/ODBC driver name, host name, port number, and authentication type.
Also, note that Databricks Delta tables can be accessed through the Databricks Delta JDBC driver, while Databricks SQL endpoints can be accessed through the Databricks SQL Endpoint JDBC/ODBC driver.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-28-2023 10:41 PM
Hi @ananthakrishna raikar
Thank you for posting your question in our community! We are happy to assist you.
To help us provide you with the most accurate information, could you please take a moment to review the responses and select the one that best answers your question?
This will also help other community members who may have similar questions in the future. Thank you for your participation and let us know if you need any further assistance!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-01-2023 09:05 AM
Team,
Really i would like to thank you for prompt support.
Meantime am facing challenges while connecting delta table around 5 MB data.
we would like to connect minimum 150 MB data stored in delta table .
Appreciate your valuable guidance/support on the same.
Thanks in advance,