{"library":"snowflake-cli","title":"Snowflake CLI","type":"library","description":"Snowflake CLI is an open-source command-line interface designed for developers building applications and managing workloads on Snowflake. It supports tasks across Streamlit in Snowflake, the Snowflake Native App Framework, Snowpark Container Services, and general SQL operations. The library maintains an active development pace with frequent, often monthly or bi-monthly, releases and major version updates introducing significant behavior changes.","language":"python","status":"active","last_verified":"Mon Apr 13","install":{"commands":["pip install snowflake-cli"],"cli":{"name":"snow","version":"Snowflake CLI version: 3.17.1"}},"imports":[],"auth":{"required":false,"env_vars":[]},"links":{"homepage":"https://www.snowflake.com","github":"https://github.com/snowflakedb/snowflake-cli","docs":null,"changelog":null,"pypi":"https://pypi.org/project/snowflake-cli/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null},"quickstart":{"code":"# 1. Install Snowflake CLI (if not already installed)\n# pip install snowflake-cli\n\n# 2. Add a new connection interactively\n# This command will prompt you for connection details like account, user, warehouse, etc.\n# For non-interactive use, consider environment variables (SNOWFLAKE_ACCOUNT, SNOWFLAKE_USER, SNOWFLAKE_PASSWORD) or a pre-configured config.toml file.\nprint('Run \"snow connection add\" and follow the prompts to set up a connection.')\nprint('Example prompts: \\n  Connection name: my_snowflake_conn\\n  Account: <your_account_identifier>\\n  User: <your_username>\\n  Password: <your_password>')\n\n# Simulate environment variables for a non-interactive quickstart (replace with actual values)\nimport os\nos.environ['SNOWFLAKE_ACCOUNT'] = os.environ.get('SNOWFLAKE_ACCOUNT', 'your_account_identifier')\nos.environ['SNOWFLAKE_USER'] = os.environ.get('SNOWFLAKE_USER', 'your_username')\nos.environ['SNOWFLAKE_PASSWORD'] = os.environ.get('SNOWFLAKE_PASSWORD', 'your_password')\n\n# 3. Execute a simple SQL query using the configured connection\n# Assuming a default connection 'my_snowflake_conn' has been set up\nprint('\\nExecuting a simple SQL query:')\n# Use --connection to explicitly specify the connection name\n# For simplicity, if one connection is default, it might not be needed.\n# In a real script, consider using `snow connection set-default my_snowflake_conn` first, or pass --connection.\nimport subprocess\nresult = subprocess.run(['snow', 'sql', '--query', 'SELECT CURRENT_VERSION()', '--connection', 'my_snowflake_conn'], capture_output=True, text=True)\nprint(result.stdout)\nif result.stderr:\n    print(f\"Error: {result.stderr}\")\n\n# 4. Initialize a new Streamlit in Snowflake project\n# print('\\nInitializing a Streamlit project:')\n# subprocess.run(['snow', 'init', '--template', 'streamlit-python', 'my_streamlit_app_project'], check=True)\n# print('Streamlit project \"my_streamlit_app_project\" created.')\n","lang":"python","description":"This quickstart demonstrates how to install Snowflake CLI, configure a new connection, and execute a basic SQL query. It also shows how to initialize a project from a template. For authentication, it relies on environment variables or an interactively configured `config.toml` file.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}