Warehouses
Connect Snowflake
Connect Snowflake as a service user with a key pair and a role that can only read, so Ahamo's AI can query your warehouse.
Snowflake connects as a service user that signs in with a key pair. Statements run as that user's default role and on its default warehouse. Ahamo never switches the role.
Availability. The Snowflake connector must be on for your workspace. See Connect a data warehouse.
Make the service user
-
Make a key pair, with no passphrase.
openssl genrsa 2048 | openssl pkcs8 -topk8 -inform PEM -out rsa_key.p8 -nocrypt openssl rsa -in rsa_key.p8 -pubout -out rsa_key.pub -
In Snowflake, as a role that may create users and roles, such as SECURITYADMIN, make a role that can only read and a service user with the public key. Use your own names. The public key is
rsa_key.pubwithout its BEGIN and END lines.CREATE ROLE ahamo_reader; GRANT USAGE ON WAREHOUSE reporting_wh TO ROLE ahamo_reader; GRANT USAGE ON DATABASE sales TO ROLE ahamo_reader; GRANT USAGE ON ALL SCHEMAS IN DATABASE sales TO ROLE ahamo_reader; GRANT SELECT ON ALL TABLES IN DATABASE sales TO ROLE ahamo_reader; GRANT SELECT ON FUTURE TABLES IN DATABASE sales TO ROLE ahamo_reader; GRANT SELECT ON ALL VIEWS IN DATABASE sales TO ROLE ahamo_reader; CREATE USER ahamo_service TYPE = SERVICE RSA_PUBLIC_KEY = 'MIIBIjANBgkq…' DEFAULT_ROLE = ahamo_reader DEFAULT_WAREHOUSE = reporting_wh DEFAULT_SECONDARY_ROLES = (); GRANT ROLE ahamo_reader TO USER ahamo_service;
Grant the user no other role, and keep DEFAULT_SECONDARY_ROLES = (), because a statement can use the rights of any active secondary role. PUBLIC is granted to everyone, so grant PUBLIC nothing you wouldn't let Ahamo read.
Snowflake has no limit on the bytes a query reads. Give the user a small warehouse of its own, with auto-suspend and a resource monitor.
Connect
- Open Connectors, find Snowflake and choose Connect.
- Enter the account identifier, as
orgname-account_namefrom your account's address, and the service user's name. - Choose what the user's role can do. Choose Only read for a role like the one above. With Change data, you approve each statement in a card.
- Paste the whole private key,
rsa_key.p8, from-----BEGIN PRIVATE KEY-----to-----END PRIVATE KEY-----. Ahamo keeps it encrypted and never shows it again. - Name the connection, choose who may use it, and choose Test and connect.
Ahamo doesn't read the SQL. If the role gets rights that write later, Ahamo can't tell, so keep Only read for a role that can only read.
Limits
A statement may run for 2 minutes. Snowflake stops it there, and bills it until then. Every statement carries your Ahamo id in its query tag, which Snowflake's query history shows.
Troubleshooting
This private key is encrypted. Make a key without a passphrase, or decrypt this one, and paste that. Ahamo encrypts it itself.
This is the public key. The public key belongs on the Snowflake user. Paste the private key, rsa_key.p8.
Snowflake didn't accept the key for this user. Check the account identifier and the user name, and that the user's public key belongs to this private key. DESC USER shows its fingerprint.
A network policy in Snowflake blocks Ahamo's address. Connecting from Ahamo's fixed address isn't offered for Snowflake yet. See Feature availability.
Snowflake no longer accepts this connection's key. If the user's public key changed, open the connection, choose Paste a new key and paste the new private key.