Ecto.Adapters.Snowflake (snowflake_elixir_ecto v0.2.1) View Source

Adapter module for Snowflake.

It uses the Snowflake REST API to communicate with Snowflake, with an earlier version set for JSON. There isn't an Elixir Arrow library (yet!), so it seems that setting an earlier Java version seems to give us back JSON results.

One of the major notes is you will need to enable Snowflakes QUOTED_IDENTIFIERS_IGNORE_CASE setting, which you can find here: https://docs.snowflake.com/en/sql-reference/identifiers-syntax.html#third-party-tools-and-case-insensitive-identifier-resolution

Note that this can be done on an account or if needed on a session level which you can set below.

Features

  • Nothing yet :-(

Roadmap

  • Full query support (including joins, preloads and associations)
  • Support for transactions
  • Support for data migrations
  • Support for ecto.create and ecto.drop operations
  • Support for transactional tests via Ecto.Adapters.SQL

Thanks

I just want to thank the ecto_sql library for being amazing, and being able to copy most of the decoding code from that.

Options

Snowflake is a little bit different than most other adapters (Postgres, MySQL, etc) as it communicates over HTTP and not a binary protocol. There is support for both waiting for a query (synchronous) and async queries.

To add Snowflake to your app, you need to do the folowing:

config :your_app, YourApp.Repo,
  ...

Connection options

  • :host - Server hostname, including https. Example: "https://xxx.us-east-1.snowflakecomputing.com"
  • :username - Username for your account.
  • :password - Password for your account.
  • :warehouse - Warehouse to use on Snowflake. If none set, will use default for the account.
  • :account_name - Account name. This is usually the name between the https:// and us-east-1 (or whatever region).
  • :role - the role to connect with.
  • :database - the database to connect to.
  • :schema - the schema to connect to.
  • :async - If set to true, will issue a query then connect every :async_interval to see if the query has completed.
  • :async_query_interval - How often to check if the query has completed.
  • :maintenance_database - Specifies the name of the database to connect to when creating or dropping the database. Defaults to "info"
  • :pool - The connection pool module, defaults to DBConnection.ConnectionPool
  • :connect_timeout - The timeout for establishing new connections (default: 30000)
  • :prepare - How to prepare queries, either :named to use named queries or :unnamed to force unnamed queries (default: :named)
  • :socket_options - Specifies socket configuration
  • :show_sensitive_data_on_connection_error - show connection data and configuration whenever there is an error attempting to connect to the database

Link to this section Summary

Link to this section Functions