Snowflake has recently began requiring Multi-Factor Authentication (MFA) for all users. This means that the traditional username/password authentication method is no longer feasible for programmatic or automated access to Snowflake data. Instead, you can request a keypair from Green Street and use that to authenticate.
It is called keypair authentication because it uses a public/private key pair to authenticate. Your Snowflake account is configured with the public key, and you use the private key like a password (private_key.p8 in the example below).
import snowflake.connector as sc def demo(customer_id, customer_view): conn_params = { "account": "INXHGHC-READER_GREEN_STREET_PROD", "user": f"SERVICE_{customer_id}", "private_key_file": "private_key.p8", "warehouse": f"WH_{customer_id}" } dbcon = sc.connect(**conn_params) cursor = dbcon.cursor() cursor.execute(f"SELECT COUNT(*) FROM DB_GREEN_STREET.SCH_GREEN_STREET.{customer_view}") print(f"Num rows: {cursor.fetchmany(1)[0][0]}") cursor.close() dbcon.close() if __name__ == "__main__": demo(CUSTOMER_ID, CUSTOMER_VIEW)