Skip to main content
For the complete documentation index for agents and LLMs, see llms.txt.

SnowflakeTableRetriever

Connects to a Snowflake database and executes SQL queries, returning results as a Pandas DataFrame and optional Markdown table.

Key Features

  • Executes SQL queries against Snowflake using ADBC and Polars for fast data transfer.
  • Returns results as a Pandas DataFrame (converted from Polars).
  • Optional Markdown-formatted string output for easy display in pipelines.
  • Configurable database, schema, warehouse, and role for flexible query targeting.
  • Configurable login timeout for handling slow network connections.

Configuration

Authentication

You need Snowflake credentials to use this component. Store the Snowflake password as a secret called SNOWFLAKE_API_KEY in your workspace. For more information, see Add Secrets.

  1. Drag the SnowflakeTableRetriever component onto the canvas from the Component Library.
  2. Click the component to open the configuration panel.
  3. On the General tab:
    1. Enter your Snowflake username.
    2. Enter your Snowflake account identifier.
  4. Go to the Advanced tab to configure the API key, database, schema, warehouse, login timeout, and other options.

Connections

SnowflakeTableRetriever accepts a SQL query string as input. It outputs a Pandas DataFrame (dataframe) and a Markdown table string (table).

Connect a PromptBuilder or Input component to its query input. Connect its table output to a generator or answer builder for presenting query results.

Usage Example

components:
SnowflakeTableRetriever:
type: snowflake.src.haystack_integrations.components.retrievers.snowflake.snowflake_table_retriever.SnowflakeTableRetriever
init_parameters:

Parameters

Inputs

ParameterTypeDefaultDescription
querystrThe SQL query to execute.
return_markdownOptional[bool]NoneWhether to return a Markdown-formatted string of the DataFrame. If not provided, uses the value set during initialization.

Outputs

ParameterTypeDefaultDescription
dataframeDataFrameA dictionary containing: - "dataframe": A Pandas DataFrame with the query results. - "table": A Markdown-formatted string representation of the DataFrame.
tablestrA dictionary containing: - "dataframe": A Pandas DataFrame with the query results. - "table": A Markdown-formatted string representation of the DataFrame.

Init Parameters

These are the parameters you can configure in Pipeline Builder:

ParameterTypeDefaultDescription
userstrUser's login.
accountstrSnowflake account identifier.
api_keySecretSecret.from_env_var('SNOWFLAKE_API_KEY')Snowflake account password.
databaseOptional[str]NoneName of the database to use.
db_schemaOptional[str]NoneName of the schema to use.
warehouseOptional[str]NoneName of the warehouse to use.
login_timeoutOptional[int]60Timeout in seconds for login.
return_markdownboolTrueWhether to return a Markdown-formatted string of the DataFrame.

Run Method Parameters

These are the parameters you can configure for the component's run() method. This means you can pass these parameters at query time through the API, in Playground, or when running a job. For details, see Modify Pipeline Parameters at Query Time.

ParameterTypeDefaultDescription
querystrThe SQL query to execute.
return_markdownOptional[bool]NoneWhether to return a Markdown-formatted string of the DataFrame. If not provided, uses the value set during initialization.