dataset_run.rb

lib/sequel/extensions/dataset_run.rb
Last Update: 2024-09-05 15:28:33 -0700

The dataset_run extension is designed for cases where you want to use dataset methods to build a query, but want to run that query without returning a result. The most common need would be to easily use placeholders in an SQL string, which Database#run does not support directly.

You can load this extension into specific datasets:

ds = DB["GRANT SELECT ON ? TO ?", :table, :user]
ds = ds.extension(:dataset_run)
ds.run

Or you can load it into all of a database’s datasets, which is probably the desired behavior if you are using this extension:

DB.extension(:dataset_run)
DB["GRANT SELECT ON ? TO ?", :table, :user].run

Related module: Sequel::DatasetRun