Skip to main content

Python package to make it easy to develop beautiful, performant streamlit-in-snowflake apps

Project description

sis-extras

Overview

The sis-extras package provides a set of Python utilities designed to help you develop beautiful, performant streamlit-in-snowflake apps.

Currently, this package includes modules for managing database connections (connection.py) and creating interactive data tiles (formatting.py).

Installation

To install sis-extras, you can use pip:

pip install sis-extras

Modules

connection.py

This module handles connections to Snowflake databases, providing functionality to manage sessions and execute SQL queries directly, returning results in a Pandas DataFrame format.

Key Functions:

  • SnowparkConnection: Manages Snowflake database connections.
  • get_data_frame_from_raw_sql: Executes a SQL query and returns the results as a Pandas DataFrame.
  • get_pandas_df: Converts a Snowpark DataFrame to a Pandas DataFrame.
  • join_cached: Provides a cached mechanism for joining two Snowpark DataFrames.

formatting.py

This module aids in the visualization of data using Streamlit, Altair, and Plotly, focusing on creating interactive tiles that can display data, charts, and SQL queries.

Key Functions:

  • tile: Creates a tile in Streamlit that can display a chart, data preview, SQL query, and a description.
  • tile_ctx: A context manager version of tile for more flexible content management within a tile.
  • altair_time_series: Generates a time series chart using Altair, designed to handle specific formatting and tooltip requirements.

Usage Examples

Using SnowparkConnection

from sis_extras.connection import get_table, get_data_frame_from_raw_sql, get_pandas_df

# Use Snowpark API

table = get_table("your_table").limit(10)

table_pd = get_pandas_df(table)

st.write(table_pd)

# Use SQL

table_pd = get_data_frame_from_raw_sql("SELECT * FROM your_table")

st.write(table_pd)

Creating a Data Tile

from sis_extras.formatting import tile
import pandas as pd
import altair as alt

# Sample DataFrame

data = pd.DataFrame({
    'x': range(10),
    'y': range(10)
})

# Sample Chart

chart = alt.Chart(data).mark_line().encode(
    x='x',
    y='y'
)

# Create a tile with data and chart

tile(data, "Sample Tile", chart=chart, sql="SELECT x, y FROM your_table")

Shows a tile with data and chart

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sis_extras-0.1.1.tar.gz (7.5 kB view details)

Uploaded Source

Built Distribution

sis_extras-0.1.1-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

Details for the file sis_extras-0.1.1.tar.gz.

File metadata

  • Download URL: sis_extras-0.1.1.tar.gz
  • Upload date:
  • Size: 7.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: pdm/2.15.3 CPython/3.10.12 Linux/6.5.0-1021-azure

File hashes

Hashes for sis_extras-0.1.1.tar.gz
Algorithm Hash digest
SHA256 6533dce23f97d13196c96144df9f139b0955497d0f2b383ccaf37b6e53cc2a93
MD5 cd070c95e2877db5a78f757b2cc6a09d
BLAKE2b-256 23f78cd175a51baed4962bf51eecb8151c460c7ca7fe4a63686c89aa9c359424

See more details on using hashes here.

File details

Details for the file sis_extras-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: sis_extras-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 7.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: pdm/2.15.3 CPython/3.10.12 Linux/6.5.0-1021-azure

File hashes

Hashes for sis_extras-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 39960864576e99429380ed6ac77b53ce1987e043c9385f6f668d4cfa8652cad9
MD5 8d25c1af1b13a660a21162524cc8be33
BLAKE2b-256 c0519e94d9b7efb2d7c39c2189d3d581d9e4fe59c784f682023b2995b92ace07

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page