Connecting to Snowflake

Connect Lucaro to your Snowflake data warehouse to query data, build dashboards, and analyze your metrics.

Prerequisites

  • A Snowflake account with database access
  • User credentials (username/password or key pair)
  • Warehouse with compute capacity
  • Read access to required schemas and tables

Connection Methods

Username/Password

Simple authentication using Snowflake username and password.

Best for: Development and testing

Key Pair Authentication

More secure authentication using RSA key pairs.

Best for: Production environments

Setup Instructions

1. Create a Lucaro User (Recommended)

-- Create a dedicated user for Lucaro
CREATE USER lucaro_user
  PASSWORD = 'strong-password-here'
  DEFAULT_WAREHOUSE = 'LUCARO_WH'
  DEFAULT_ROLE = 'LUCARO_ROLE';

-- Create a read-only role
CREATE ROLE lucaro_role;

-- Grant access to required databases/schemas
GRANT USAGE ON DATABASE analytics TO ROLE lucaro_role;
GRANT USAGE ON SCHEMA analytics.public TO ROLE lucaro_role;
GRANT SELECT ON ALL TABLES IN SCHEMA analytics.public TO ROLE lucaro_role;
GRANT SELECT ON FUTURE TABLES IN SCHEMA analytics.public TO ROLE lucaro_role;

-- Assign role to user
GRANT ROLE lucaro_role TO USER lucaro_user;

2. Create a Warehouse

-- Create a dedicated warehouse for Lucaro queries
CREATE WAREHOUSE lucaro_wh
  WITH WAREHOUSE_SIZE = 'X-SMALL'
  AUTO_SUSPEND = 60
  AUTO_RESUME = TRUE
  INITIALLY_SUSPENDED = TRUE;

GRANT USAGE ON WAREHOUSE lucaro_wh TO ROLE lucaro_role;

3. Connect in Lucaro

curl -X POST "https://api.lucaro.dev/v2/projects/{projectId}/integrations" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "type": "snowflake",
    "name": "Production Snowflake",
    "config": {
      "account": "xy12345.us-east-1",
      "user": "lucaro_user",
      "password": "your-password",
      "warehouse": "LUCARO_WH",
      "database": "ANALYTICS",
      "schema": "PUBLIC",
      "role": "LUCARO_ROLE"
    }
  }'

Key Pair Authentication

For enhanced security, use RSA key pair authentication:

Generate Key Pair

# Generate private key
openssl genrsa 2048 | openssl pkcs8 -topk8 -inform PEM -out rsa_key.p8 -nocrypt

# Generate public key
openssl rsa -in rsa_key.p8 -pubout -out rsa_key.pub

# Assign to user in Snowflake
ALTER USER lucaro_user SET RSA_PUBLIC_KEY='MIIBIjANBgkq...';

Connect with Key Pair

{
  "type": "snowflake",
  "config": {
    "account": "xy12345.us-east-1",
    "user": "lucaro_user",
    "private_key": "-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----",
    "warehouse": "LUCARO_WH",
    "database": "ANALYTICS",
    "schema": "PUBLIC"
  }
}

Connection Options

OptionRequiredDescription
accountYesSnowflake account identifier
userYesUsername for authentication
passwordNo*Password (or use private_key)
warehouseYesCompute warehouse name
databaseYesDefault database
schemaNoDefault schema (defaults to PUBLIC)
roleNoRole to use for queries

Verify Connection

After connecting, Lucaro will automatically:

  • Test the connection with a simple query
  • Discover available schemas and tables
  • Capture column metadata and types
  • Enable the schema browser in the dashboard builder

Best Practices

  • Use X-SMALL warehouse - Lucaro queries are optimized and don't need large warehouses
  • Enable auto-suspend - Set to 60 seconds to minimize costs
  • Use read-only role - Lucaro only reads data, never writes
  • Limit schema access - Only grant access to analytics schemas