Giter Site home page Giter Site logo

cnb-snowflake-odbc's Introduction

heroku-buildpack-snowflake-odbc

Usage

This requires heroku-buildpack-apt to run before it, with the following in the Aptfile:

Use the latest url from snowflake odbc repository or use the copy stored in this repo

unixodbc
unixodbc-dev
https://sfc-repo.snowflakecomputing.com/odbc/linux/2.21.3/snowflake-odbc-2.21.3.x86_64.deb

You can configure the credentials for your connection usign the following ENV variables

  • SNOWFLAKE_USERNAME
  • SNOWFLAKE_PASSWORD
  • SNOWFLAKE_DATABASE
  • SNOWFLAKE_SERVER

CONNECTING TO SNOWFLAKE USING THE OBDC DRIVER & RUBY

these tutorial is a copy of snowflake connection with ruby tutorial A connection to Snowflake can be configured using the Snowflake ODBC driver and the Ruby gem package 'Sequel', https://github.com/jeremyevans/sequel.

Sample code:

#!/usr/local/bin/ruby
# odbc-snowflake.rb - access database via ODBC using Sequel gem
require 'odbc' # gem 'ruby-odbc'
require 'sequel' # gem 'sequel'
begin
db = Sequel.odbc('<snowflake dns>', user: '<username>', password: '<password>')
puts 'SELECT * FROM sales LIMIT 10'
db.fetch('SELECT * FROM sales LIMIT 10') do |row|
puts row
end
rescue => e
puts 'An error occurred'
puts "Error code: #{e.inspect}"
ensure
# disconnect from server
db.disconnect if db
end

Where is the DNS entry from the odbc.ini file.

Additional Information:

Gem package 'dpi' relies on the 'deprecated' package version 2.0.1. It is incompatible with Rails 5 ('deprecated' > 3.0.1). See the following StackOverflow article for details: http://stackoverflow.com/questions/9456768/getting-undefined-method-deprecate-error-in-ruby-dbi-gem

HOW TO USE THESE CONNECTION

db = Sequel.odbc('snowflake')

Connection with R&R and ActiveRecord

https://eng.localytics.com/connecting-to-snowflake-with-ruby-on-rails/ or check the PDF file attached

Reference

cnb-snowflake-odbc's People

Contributors

isaacseymour avatar edgarv09 avatar portersupport avatar zerobearing2 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.