These are chat archives for rails-sqlserver/activerecord-sqlserver-adapter

7th
Jun 2017
SoNerds
@SoNerds
Jun 07 2017 09:40
Hi people someone can give me some light about how can i connect a ruby on rails webiste to a sql server ???
Ken Collins
@metaskills
Jun 07 2017 11:32
@ehansen486 I've done it before. Many gigs of data too. Ruby to SQL is never going to be as fast as a pure SQL statement/proc of some sort. Only way you can re-use insert statments for raw TinyTDS is how the adapter does with MS' sp_executesql. You will need to write up your params manually tho. Not sure it is worth it. How much data are you doing? ETL of any type?
@SoNerds It should be very straight forward. Basically ensuring the right username and password in ActiveRecord's database.yml is the only thing you need to do. Using Rails with SQL Server is like any other DB now in Rails now. There is no special magic past installing the gems.
For those getting started, not legacy DBs or apps, I wrote this article the other day.
SoNerds
@SoNerds
Jun 07 2017 13:50
@metaskills tnks very much
Ken Collins
@metaskills
Jun 07 2017 14:59
Sure! Keep asking questions if you have any. Glad to help where and when I can.
SoNerds
@SoNerds
Jun 07 2017 16:30
@metaskills Can i have two databases one local and one external in the same website ??
Ken Collins
@metaskills
Jun 07 2017 16:57
Sure! They can be anywhere.
Can be n-number of databases. Creds can be read/write. What ever you want. ActiveRecord allows you to use establish_connection for a base model to another DB... v5.1 even brought above new YAML format to support this too.
SoNerds
@SoNerds
Jun 07 2017 17:00
@metaskills but how i define both databases ? @_@
Ken Collins
@metaskills
Jun 07 2017 17:00
There are so many ways. Let me scrap up a few links on the topic
You will have to find which one meets your needs the best. This is nothing about the adpter... just base ActiveRecord stuff.
SoNerds
@SoNerds
Jun 07 2017 17:03
@metaskills i really thankful!
On Rails v5.1, I just found this out...
So read that article, choose Secondbase if it right for you. For example: if maintaining dual schema representations are important.
Or, as needed... read what did make it into Rails v5.1 and use that method with some of the simple ifo in that first article. rails/rails#28095
Hope that helps.
SoNerds
@SoNerds
Jun 07 2017 17:07
helps a lot :) tnks one more time ^^