Yukii's Blog

Yet Another Tech Blog.

You should not use `dbi` gem in Rails project.

2019/02/25

TL; DR

You should not use dbi gem inside Rails project.

Otherwise, you’ll get an error something like:

{:sanitize_conditions=>:sanitize_sql} is not a symbol nor a string

Description

In Daru, it seems to support Daru::DataFrame#write_sql method, which seems to support data insertions from Dataframe according to the doc. https://www.rubydoc.info/gems/daru/Daru/DataFrame#write_sql-instance_method

To use this method, one is instructed to use the dbi gem. This gem, however, is incompatible with Rails due to the fact that it depends on the deprecated gem which creates Module#deprecate method, which conflicts with ActiveSupport’s deprecate method.

According to the comment in an issue at dbi gem repo, it is recommended to use rdbi gem instead. I’ll probably look into this gem to see whether it could be used on a Rails + Daru project.

tags:  daru  rails  dbi