Connecting to Data¶
This guide explains how to connect to the EWE Numera data platform from various tools and programming languages.
Connection Details¶
| Setting | Production | Development |
|---|---|---|
| Account | Contact your administrator | Contact your administrator |
| Database | NUMERA_EWE_PROD_CORE |
NUMERA_EWE_DEV_CORE |
| Schema | NUMERA_DIM_MODEL |
NUMERA_DIM_MODEL |
| Warehouse | NUMERA_PROD_REPORTING |
NUMERA_DEV_REPORTING |
| Role | NUMERA_EWE_PROD_REPORTER |
NUMERA_EWE_DEV_REPORTER |
Power BI¶
Direct Query Connection¶
- In Power BI Desktop, select Get Data > Snowflake
- Enter connection details:
- Server:
<account>.snowflakecomputing.com - Warehouse:
NUMERA_PROD_REPORTING - Choose DirectQuery for live data
- Enter credentials when prompted
- Select the
NUMERA_DIM_MODELschema - Choose tables to import
Import Mode¶
For smaller datasets or when offline access is needed:
- Follow steps 1-4 above
- Choose Import instead of DirectQuery
- Set up scheduled refresh in Power BI Service
Best Practices for Power BI¶
- Use DirectQuery for large fact tables (fct_pnl, fct_schedule)
- Use Import for dimension tables
- Create relationships using surrogate keys (
dim_*_id) - Filter metric_date at the report level to limit data
Tableau¶
Connection Setup¶
- In Tableau, select Connect > Snowflake
- Enter connection details:
- Server:
<account>.snowflakecomputing.com - Role:
NUMERA_EWE_PROD_REPORTER - Warehouse:
NUMERA_PROD_REPORTING - Database:
NUMERA_EWE_PROD_CORE - Sign in with your credentials
- Select
NUMERA_DIM_MODELschema - Drag tables to the canvas
Best Practices for Tableau¶
- Use Live Connection for real-time data
- Use Extract for better performance with large datasets
- Set up incremental extracts on metric_date
- Create data source filters on transaction status
Python¶
Using snowflake-connector-python¶
import snowflake.connector
import pandas as pd
# Connection configuration
conn_params = {
"user": "your_username",
"password": "your_password", # Or use other auth methods
"account": "your_account.snowflakecomputing.com",
"database": "NUMERA_EWE_PROD_CORE",
"schema": "NUMERA_DIM_MODEL",
"warehouse": "NUMERA_PROD_REPORTING",
"role": "NUMERA_EWE_PROD_REPORTER"
}
# Create connection
conn = snowflake.connector.connect(**conn_params)
# Execute query and return DataFrame
def query_to_df(sql):
cur = conn.cursor()
cur.execute(sql)
return cur.fetch_pandas_all()
# Example usage
df = query_to_df("""
SELECT metric_date, portfolio, SUM(pnl_ltd) as total_pnl
FROM fct_pnl f
JOIN dim_deal_attribute d ON f.dim_deal_attribute_id = d.dim_deal_attribute_id
WHERE metric_date >= DATEADD('day', -7, CURRENT_DATE)
GROUP BY metric_date, portfolio
""")
print(df)
# Close connection when done
conn.close()
Using Key-Pair Authentication¶
For automated/service accounts, use key-pair authentication:
import snowflake.connector
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives import serialization
# Load private key
with open("/path/to/private_key.p8", "rb") as key_file:
private_key = serialization.load_pem_private_key(
key_file.read(),
password=b'your_passphrase', # Or None if unencrypted
backend=default_backend()
)
conn = snowflake.connector.connect(
user="service_account",
account="your_account.snowflakecomputing.com",
private_key=private_key,
database="NUMERA_EWE_PROD_CORE",
schema="NUMERA_DIM_MODEL",
warehouse="NUMERA_PROD_REPORTING",
role="NUMERA_EWE_PROD_REPORTER"
)
Using MFA Token Caching¶
For interactive sessions with MFA:
conn = snowflake.connector.connect(
user="your_username",
password="your_password",
account="your_account.snowflakecomputing.com",
authenticator="username_password_mfa",
client_store_temporary_credential=True,
client_request_mfa_token=True,
database="NUMERA_EWE_PROD_CORE",
schema="NUMERA_DIM_MODEL",
warehouse="NUMERA_PROD_REPORTING",
role="NUMERA_EWE_PROD_REPORTER"
)
Excel¶
Using Snowflake ODBC Driver¶
- Install the Snowflake ODBC Driver
- Configure an ODBC Data Source:
- Server:
<account>.snowflakecomputing.com - Database:
NUMERA_EWE_PROD_CORE - Schema:
NUMERA_DIM_MODEL - Warehouse:
NUMERA_PROD_REPORTING - Role:
NUMERA_EWE_PROD_REPORTER - In Excel, go to Data > Get Data > From Other Sources > From ODBC
- Select your Snowflake data source
- Write your SQL query or select tables
SQL Clients¶
DBeaver¶
- Create new connection: Database > New Database Connection
- Select Snowflake
- Enter connection details:
- Host:
<account>.snowflakecomputing.com - Database:
NUMERA_EWE_PROD_CORE - Schema:
NUMERA_DIM_MODEL - Warehouse:
NUMERA_PROD_REPORTING - Role:
NUMERA_EWE_PROD_REPORTER - Test connection and save
DataGrip¶
- Create new data source: + > Snowflake
- Enter connection details in the connection dialog
- Download driver if prompted
- Test connection
Authentication Methods¶
Password Authentication¶
Standard username/password login. May require MFA.
SSO (Single Sign-On)¶
For organizations with SSO configured:
conn = snowflake.connector.connect(
user="your_email@company.com",
account="your_account.snowflakecomputing.com",
authenticator="externalbrowser",
# ... other params
)
Key-Pair Authentication¶
For service accounts and automation. See Python example above.
OAuth¶
For applications integrating with identity providers:
conn = snowflake.connector.connect(
user="your_username",
account="your_account.snowflakecomputing.com",
authenticator="oauth",
token="your_oauth_token",
# ... other params
)
Troubleshooting¶
Connection Refused¶
- Verify account name format:
<account>.<region>.snowflakecomputing.com - Check network/firewall settings
- Ensure VPN is connected if required
Insufficient Privileges¶
- Verify role assignment:
SHOW GRANTS TO USER your_username; - Request role access from administrator
- Ensure you're using the correct role in connection settings
Warehouse Suspended¶
The warehouse may auto-suspend to save costs:
- Queries will auto-resume the warehouse
- First query may take a few seconds longer
- Contact administrator if warehouse doesn't resume
Query Timeout¶
For long-running queries:
Required Permissions¶
The NUMERA_EWE_PROD_REPORTER role grants:
USAGEon databaseNUMERA_EWE_PROD_COREUSAGEon schemaNUMERA_DIM_MODELSELECTon all tables and views in the schemaUSAGEon warehouseNUMERA_PROD_REPORTING
Getting Help¶
- For access requests, contact your Snowflake administrator
- For data questions, see Query Patterns
- For technical issues, see Troubleshooting