How to connect Snowflake Database with ODBC
Snowflake offers ODBC driver which make Iguana connecting to snowflake easily. See detail below
Architecture Design
ODBC Setup
Download and Install ODBC Driver: ODBC Driver - Developer Resources
Collect the following Snowflake Configurations for ODBC:
Server URL: XXX.snowflakecomputing.com
User Credentials (username and password)
User Role (ex. ACCOUNTADMIN)
Warehouse Name (ex. COMPUTE_WH)
Database name
Database Schema
Once setup, click on Test and receive success notification
Â
Iguana Translator Sample
-- The main function is the first function called from Iguana.
function main()
local conn = db.connect{
api=db.ACCESS, -- "ODBC Cheat" - this (or another ODBC connection type) will work with most ODBC connections
name='Snowflake',
user='Test',
password='Password',
use_unicode = true,
live = true
}
local sqlStr = [==[
SELECT
l_returnflag,
l_linestatus,
count(*) as count_order
FROM
lineitem
WHERE
l_shipdate <= dateadd(day, -90, to_date('1998-12-01'))
GROUP BY
l_returnflag,
l_linestatus]==]
local res = conn:query{sql=sqlStr, live=true}
end
Â