Last active
March 4, 2017 23:25
-
-
Save localytics-gist/ba9fe94a9627908ccaa28758b18ab5ad to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Ensure we have loaded the adapter | |
| require 'odbc_adapter' | |
| # Individual ActiveRecord (and ODBC) adapters get required when they are referenced, | |
| # so we need to explicitly require the PostgreSQL adapter here so we can subclass it | |
| require 'odbc_adapter/adapters/postgresql_odbc_adapter' | |
| # Register a dynamically-defined adapter that will subclass the PostgreSQL adapter, | |
| # and tell ODBCAdapter to use it when the connected-to DBMS reports back a name | |
| # matching the given pattern (in this case vertica). | |
| ODBCAdapter.register(/vertica/i, ODBCAdapter::Adapters::PostgreSQLODBCAdapter) do | |
| # Override the `quote_column_name` method to make it function more closely to what | |
| # Vertica expects in its queries | |
| def quote_column_name(name) | |
| name.to_s | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment