### Install Zaturn Source: https://context7.com/kdqed/zaturn/llms.txt Install Zaturn using pip or uv. ```bash pip install zaturn ``` ```bash uv add zaturn ``` -------------------------------- ### Launch Zaturn Studio Source: https://context7.com/kdqed/zaturn/llms.txt Start the Zaturn Studio web interface, which runs a Flask development server on http://localhost:6066. ```bash zaturn_studio ``` -------------------------------- ### Claude Desktop MCP Configuration Source: https://context7.com/kdqed/zaturn/llms.txt Example JSON configuration for setting up Zaturn as an MCP server in Claude Desktop. ```json { "mcpServers": { "zaturn": { "command": "zaturn_mcp", "args": [ "postgresql://user:password@localhost:5432/mydb", "/path/to/data.csv" ] } } } ``` -------------------------------- ### Launch `zaturn_mcp` with CLI data sources Source: https://context7.com/kdqed/zaturn/llms.txt Launch the MCP server with various data sources specified as command-line arguments. Supports SQLite, PostgreSQL, MySQL, SQL Server, ClickHouse, DuckDB, CSV, Parquet, and BigQuery. Multiple sources can be provided, or no arguments to use the demo dataset. ```bash zaturn_mcp sqlite:///path/to/mydata.db ``` ```bash zaturn_mcp postgresql://user:password@localhost:5432/mydb ``` ```bash zaturn_mcp mysql://user:password@localhost:3306/mydb ``` ```bash zaturn_mcp mssql://user:password@localhost:1433/mydb ``` ```bash zaturn_mcp clickhouse://user:password@localhost:8123/mydb ``` ```bash zaturn_mcp /path/to/analytics.duckdb ``` ```bash zaturn_mcp /path/to/sales_data.csv ``` ```bash zaturn_mcp /path/to/events.parquet ``` ```bash zaturn_mcp bigquery://my-gcp-project/my_dataset ``` ```bash zaturn_mcp sqlite:///inventory.db postgresql://user:pass@host/analytics /data/logs.csv ``` ```bash zaturn_mcp ``` -------------------------------- ### List Data Sources with `Core` Tool Source: https://context7.com/kdqed/zaturn/llms.txt Use the `list_data_sources` method from the `Core` class to list registered data sources and their tables. Requires a dictionary of sources and their configurations. ```python from zaturn.tools.core import Core sources = { "sales-csv": {"source_type": "csv", "url": "/data/sales.csv"}, "warehouse-postgresql": { "source_type": "postgresql", "url": "postgresql://user:pass@localhost:5432/warehouse" }, } core = Core(sources) result = core.list_data_sources() print(result) ``` -------------------------------- ### Configure Persistent Sources via File Source: https://context7.com/kdqed/zaturn/llms.txt Configure persistent data sources by creating a `sources.txt` file. The file path is platform-dependent. Sources in this file take priority over CLI arguments. ```bash cat > ~/.local/share/zaturn/zaturn/sources.txt <= '2024-01-01' GROUP BY 1, 2 ORDER BY 1 """, x="week", y="total_revenue", color="region", # draws one line per region ) ``` -------------------------------- ### Generate Scatter Plot with scatter_plot Source: https://context7.com/kdqed/zaturn/llms.txt Renders query results as a scatter plot PNG. Maps a third column to point color using the optional `color` parameter. Returns an MCP `ImageContent` object. ```python from zaturn.tools.visualizations import Visualizations sources = { "pokemon-csv": { "source_type": "csv", "url": "/path/to/all_pokemon_data.csv" } } viz = Visualizations(sources) image = viz.scatter_plot( source_id="pokemon-csv", query="SELECT attack, defense, type1 FROM CSV WHERE legendary = false", x="attack", y="defense", color="type1", # optional: color points by Pokémon type ) # image.type == 'image' # image.mimeType == 'image/png' # image.data -> base64-encoded PNG string ``` -------------------------------- ### Generate Box Plot from SQL Query Source: https://context7.com/kdqed/zaturn/llms.txt Use `box_plot` to visualize distribution statistics from a SQL query. Requires specifying the source ID, SQL query, and columns for x, y, and optional color. ```python from zaturn.tools.visualizations import Visualizations sources = { "hr-mysql": { "source_type": "mysql", "url": "mysql+pymysql://user:pass@localhost:3306/hr" } } viz = Visualizations(sources) image = viz.box_plot( source_id="hr-mysql", query="SELECT department, salary FROM employees WHERE employment_status = 'active'", x="department", y="salary", color="department", # optional ) ``` -------------------------------- ### Generate Polar Scatter and Line Plots Source: https://context7.com/kdqed/zaturn/llms.txt Use `polar_scatter` for individual points or `polar_line` for closed lines in polar coordinates, suitable for cyclic data. Specify source ID, query, and columns for radius (r) and angle (theta), with optional color. ```python from zaturn.tools.visualizations import Visualizations sources = { "wind-csv": {"source_type": "csv", "url": "/data/wind_readings.csv"} } viz = Visualizations(sources) # Polar scatter image = viz.polar_scatter( source_id="wind-csv", query="SELECT wind_speed, wind_direction, station FROM CSV", r="wind_speed", theta="wind_direction", color="station", # optional ) # Polar line (closed) image = viz.polar_line( source_id="wind-csv", query="SELECT AVG(wind_speed) AS avg_speed, wind_direction FROM CSV GROUP BY wind_direction ORDER BY wind_direction", r="avg_speed", theta="wind_direction", ) ``` -------------------------------- ### Conditional Chat Rendering Logic Source: https://github.com/kdqed/zaturn/blob/main/zaturn/studio/templates/chat.html This Jinja2 template code iterates through chat messages and their parts, rendering different components based on the 'part_kind' and 'kind' attributes. It handles system prompts, user prompts, AI responses, and tool returns. A fallback displays the entire chat object as JSON if the schema version is less than 1. ```html {% if chat.get('schema_version', 0) >= 1 %} {% for message in chat['messages'] %} {% for part in message['parts'] %} {% if part['part_kind']=='system-prompt' %} {% include('chat_metadata.html') %} {% elif part['part_kind']=='user-prompt' %} {% include('user_message.html') %} {% elif part['part_kind']=='text' and message['kind']=='response' %} {% include('ai_message.html') %} {% elif part['part_kind']=='tool-return' %} {% include('function_call.html') %} {% endif %} {% endfor %} {% endfor %} {% include('icons/arrow-right.svg') %} {% include('loader.html') %} {% else %} {{chat | tojson(indent=2)}} {% endif %} ``` -------------------------------- ### Generate Strip Plot from SQL Query Source: https://context7.com/kdqed/zaturn/llms.txt Use `strip_plot` to display individual data points from a SQL query. Useful for showing the full distribution and spread. Specify source ID, query, and columns for x, y, and color. ```python from zaturn.tools.visualizations import Visualizations sources = { "experiments-csv": { "source_type": "csv", "url": "/data/ab_test_results.csv" } } viz = Visualizations(sources) image = viz.strip_plot( source_id="experiments-csv", query="SELECT variant, conversion_rate FROM CSV", x="variant", y="conversion_rate", color="variant", ) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.