Module: SnowflakeOdbcAdapter::Snowflake

Defined in:
lib/snowflake_odbc_adapter/snowflake.rb

Overview

Snowflake specific overrides

Constant Summary collapse

PRIMARY_KEY =
"BIGINT UNIQUE PRIMARY KEY AUTOINCREMENT START 1 INCREMENT 1 ORDER "

Class Method Summary collapse

Class Method Details

.column_filters(columns) ⇒ Object

Remove Snowflake specific columns



9
10
11
# File 'lib/snowflake_odbc_adapter/snowflake.rb', line 9

def column_filters(columns)
  columns.reject { |col| col[0] =~ /^snowflake$/i }.reject { |col| col[1] =~ /^account_usage$/i }
end

.table_filter(tables, connection) ⇒ Object

Remove outside database tables



20
21
22
23
# File 'lib/snowflake_odbc_adapter/snowflake.rb', line 20

def table_filter(tables, connection)
  database = connection.get_info(ODBC::SQL_DATABASE_NAME)
  tables.select { |table| table[0] == database && table[3] =~ /^TABLE$/i }
end

.type_mapper(col) ⇒ Object



13
14
15
16
17
# File 'lib/snowflake_odbc_adapter/snowflake.rb', line 13

def type_mapper(col)
  # Transform DECIMAL 38 0 into BIGINT ODBC Specific
  return "bigint" if col[4] == ODBC::SQL_DECIMAL && col[8] == 0 && col[6] == 38
  col[4]
end

.view_filter(tables, connection) ⇒ Object

Remove outside database views



26
27
28
29
30
31
# File 'lib/snowflake_odbc_adapter/snowflake.rb', line 26

def view_filter(tables, connection)
  database = connection.get_info(ODBC::SQL_DATABASE_NAME)
  tables.select do |table|
    table[0] == database && table[3] =~ /^VIEW$/i && table[1] !~ /^information_schema$/i
  end
end