TinyTDS for import

I’m importing from a Snitz forum, which doesn’t have an existing import script. I’m not a Ruby developer, so I’m hacking things together as I go.

Snitz uses an MS SQL Server backend, and when I look up “Ruby MS SQL Server” everything seems to point to TinyTDS. I’m able to do that in Ruby 2.3.0, but when I try it in my script I run into dependency issues. It seems like the Docker container is running Ruby 2.0.0 and I’m not able to get TinyTDS to work because of dependency issues with activerecord and other gems (I think? Again, not really comfortable with Ruby or Rails, or Linux for that matter).

So I’m currently exporting things to a CSV file and then importing from there as a workaround, but I was curious if there was something I’m just missing in terms of getting an import script to connect to SQL. There’s probably a way to connect using something other than TinyTDS but I’m way out of my depth already and I was afraid of breaking the entire site (again… I restored my VM several times during this process because I hosed things while trying to bend things to my will).

I looked into this a while ago in order to allow importing phpBB3 from a SQL Server database. This worked for me:

./launcher enter app

apt-get install freetds-dev
echo "gem 'tiny_tds'" >> Gemfile
su discourse -c 'bundle install --no-deployment --without test --without development --path vendor/bundle'

What’s the error message in case this doesn’t work anymore?


This seems to be working. If I understand what you’re doing above, I think the only thing I didn’t do was apt-get install freetds-dev, and then I only did 'bundle install --no-deployment'.

That’s a neat trick to write to a file without installing an editor with echo. I of course had to install nano in order to edit the Gemfile.

I’m going to keep going down this path, because it would be a lot nicer to query the DB directly than this manual step of creating CSV files has been. Thanks!


@Kevin_McKinney did you finally got your import working? It will be nice if you share a script. I’m looking for old Snitz import as well. Thanks!