Questions tagged [sequel]

Sequel is a database toolkit for the Ruby programming language that provides abstractions over many SQL RDBMS.

Sequel is a "Database Toolkit for Ruby" that:

  • ...provides thread safety, connection pooling and a concise DSL for constructing SQL queries and table schemas.

  • ...includes a comprehensive ORM layer for mapping records to Ruby objects and handling associated records.

  • ...supports advanced database features such as prepared statements, bound variables, stored procedures, savepoints, two-phase commit, transaction isolation, master/slave configurations, and database sharding.

  • ...has adapters for ADO, Amalgalite, DataObjects, DB2, DBI, Firebird, Informix, JDBC, MySQL, Mysql2, ODBC, OpenBase, Oracle, PostgreSQL, SQLite3, and Swift.

See the documentation for a list of guides, examples, tutorials, and other reference material.

Sequel is currently maintained and primarily developed by Jeremy Evans.

780 questions
0
votes
1 answer

How to do Sequel query chaining with WITH and OR

I'm trying to build a query in Sequel that's causing me a bit of trouble. Basically I have several hashes, each containing several conditions. The conditions in each hash need to AND within themselves and OR within each group of conditions. For…
Greg Olsen
  • 912
  • 1
  • 9
  • 14
0
votes
1 answer

Sequel: DB2 Adapter Not Found

Okay, I've been trying to connect to a DB2 Database. I've been trying to use Sequel, in the hope of building some POROs for accessing data in my DB2 Database. So after installing Sequel, I've been trying to do the following in irb require…
DVG
  • 17,392
  • 7
  • 61
  • 88
0
votes
1 answer

Connecting directly to database with a ruby script

I am using heroku with Ruby on Rails. The data for my app however has to be copied from a different database. Initially I created the script in perl, but as I found out I cannot install the DBI perl module on the Heroku instance easily. So right…
StanM
  • 827
  • 4
  • 12
  • 33
0
votes
1 answer

Error: undefined method `like' for Sequel:Module

I get this error: Error: undefined method `like' for Sequel:Module using: @info = DB[:info].where(Sequel.like(:content, "%#{params[:sc]}%")) if params[:sc] I found the example code in Sequel's documentation: DB[:artists].where(Sequel.like(:name,…
coolesting
  • 1,451
  • 5
  • 18
  • 22
0
votes
1 answer

Sequel default example fails when switched to postgres adapter

I'm trying to run the Sequel example from http://sequel.rubyforge.org/. Everything works fine on sqlite, but fails when I switch to postgres. This is the connection code: DB = Sequel.connect(:adapter=>'postgres', :host=>'localhost',…
ddario
  • 1,015
  • 3
  • 12
  • 25
0
votes
2 answers

Sequel Migration update with a row's ID

How can you run a Sequel migration that updates a newly added column with a value from the row? The Sequel documentation shows how you can update the column with a static value: self[:artists].update(:location=>'Sacramento') What I need to do is…
Greg Olsen
  • 912
  • 1
  • 9
  • 14
0
votes
3 answers

Why can't I add 1 to the value of a Hash in ruby?

I'm using Sequel ORM @latestorder = Step.where(:tutorial_id =>data['tutorial_id']).order(Sequel.desc(:order)).limit(1) #data['tutorial_id'] is 1 @neworder = @latestorder[:order] +1; #<-- this line causes errors! NoMethodError at…
desbest
  • 4,746
  • 11
  • 51
  • 84
0
votes
1 answer

unable to disconnect from postgres database using sequel gem

I've just started using the Sequel rubygem, and it appears that the 'disconnect' method isn't working. Here is the output from my IRB test session: 1.9.3-p194 :002 > require 'sequel' => true 1.9.3-p194 :003 > DB =…
MothOnMars
  • 2,229
  • 3
  • 20
  • 23
0
votes
1 answer

How can I display a BLOB stored image using Ruby and Sequel

I am not using Rails, so the send_data function will not work, unfortunately. image = User.select("image, image_mime").where("username = '#{params[:name]}'").first send_data( image.image, :type => image.image_mime, …
desbest
  • 4,746
  • 11
  • 51
  • 84
0
votes
1 answer

How do I put these different columns into the same row in PostgreSQL?

Here's my dataset (in Hash form since I'm using the Ruby gem Sequel); the hash names are the column names: {:item_category=>"Bacon", :year=>1890, :avg_yr_value=>0.12} {:item_category=>"Eggs (dozen)", :year=>1890,…
user1626730
  • 3,783
  • 5
  • 20
  • 24
0
votes
2 answers

How to group count and join in sequel?

I've looked through all the documentation and I'm having an issue putting together this query in Sequel. select a.*, IFNULL(b.cnt, 0) as cnt FROM a LEFT OUTER JOIN (select a_id, count(*) as cnt from b group by a_id) as b ON b.a_id = a.id ORDER BY…
Greg Olsen
  • 912
  • 1
  • 9
  • 14
0
votes
1 answer

Recursive logic for parsing string into complex boolean?

I'm sure this has been done before, I just can't find it. I need to turn something like, "((A OR B) AND C) OR D" into a database query for an attribute. Specifically I'm using Ruby Sequel. Can anyone point me at an example or utility or something…
Huliax
  • 1,489
  • 3
  • 15
  • 27
0
votes
1 answer

How do I use my Sinatra-powered Ruby application to scrape data to a Heroku PostgreSQL database

I successfully pushed my Sinatra-powered Ruby app to Heroku. One of the files I pushed is a Ruby script which scrapes the web and puts data into a PostgreSQL database (that's the non-Sinatra one). I set up a PostgreSQL add-on for the Heroku app,…
user1626730
  • 3,783
  • 5
  • 20
  • 24
0
votes
1 answer

Facing NativeException: java.sql.SQLException: Connection com.mysql.jdbc.JDBC4Connection@38054ba0 is closed

My code is written in jRuby and I deployed in Tomcat using Warbler. I am using Sequel to query the MySQL database. I am using two layers of database connection pooling. One is native Sequel pooling another is JNDI pooling at the Tomcat level. The…
azi
  • 929
  • 1
  • 11
  • 31
0
votes
1 answer

Retrieve models with summed statistics

Given the following DB schema and Sequel Models, how do I select a set of nodes summed by their hits, while retaining the result as model instances with all the data and working methods thereon? Sequel.migration{ change{ create_table :nodes do …
Phrogz
  • 296,393
  • 112
  • 651
  • 745