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
4
votes
2 answers

Rails 3 integrated with Sequel?

There appear to be at least four repos on github that claim to tie in Sequel to the latest Rails 3 beta. Has anyone successfully replaced ActiveRecord with Sequel in a Rails 3 project? Could you provide some hints on how to best go about it? I'm…
pithyless
  • 1,659
  • 2
  • 16
  • 31
4
votes
1 answer

Ruby Sequel: Array returned by query is being returned as a String object, not an Array object

I'm using the pg_array extension of Ruby Sequel. When I select a column that is a Postgresql array, the result is a string in Ruby. How do I get this to be a Ruby array so I can use things like .each on it? CaseTypeCategory.first(category_name:…
Steve Wetzel
  • 435
  • 4
  • 9
4
votes
3 answers

Need help in SQL and Sequel involving inner join and where/filter

Need help transfer sql to sequel: SQL: SELECT table_t.curr_id FROM table_t INNER JOIN table_c ON table_c.curr_id = table_t.curr_id INNER JOIN table_b ON table_b.bic = table_t.bic WHERE table_c.alpha_id = 'XXX' AND table_b.name='Foo'; I'm stuck…
mhd
  • 4,561
  • 10
  • 37
  • 53
4
votes
0 answers

May I have a join between tables in different databases while using Sequel?

I'm building an integration software between two different systems. I have Clients in a database, and Groups in another. One Client can be in multiple groups, and one group can have multiple clients. So, I created an intermediate table named as…
Pedro Vinícius
  • 476
  • 6
  • 13
4
votes
2 answers

Sequel (Ruby), how to increment and use a DB counter in a safe way?

I found 4 "proper" ways to do this: In the cheat sheet for ActiveRecord users substitutes for ActiveRecord's increment and increment_counter are supposed to be album.values[:column] -= 1 # or += 1 for increment and…
bbozo
  • 7,075
  • 3
  • 30
  • 56
4
votes
1 answer

Ruby Sequel error, table already exists

I realized that I can't run the tutorial (http://sequel.jeremyevans.net/) twice. The first time, it runs as we expect. But the second time, it raises an error SQLite3::SQLException: table `items` already exists (Sequel::DatabaseError) I understand…
Quarktum
  • 669
  • 1
  • 8
  • 26
4
votes
3 answers

Best Ruby ORM for Wrapping around Legacy SQL Server Database?

I found this answer and it sounds like almost exactly what I'm doing. I have heard mixed answers about whether or not datamapper can support SQL Server through dataobjects. Basically, we have an app that uses a consistently structured database,…
Technocrat
  • 205
  • 1
  • 7
4
votes
1 answer

How to fix "sequel::DatabaseDisconnectError - Mysql::Error: MySQL server has gone away" on Heroku

I have a simple Sinatra application hosted on Heroku and using Sequel to connect to a MySql database through the ClearDB addon. The application works fine, except when it sits idle for more than a minute. In that case, the first request I make…
Jonah
  • 15,806
  • 22
  • 87
  • 161
4
votes
1 answer

Can the ClassTableInheritance plugin for Sequel be configured to store something other than the model name as the key?

I am using the class_table_inheritance Sequel plugin for my project and I have the following models: class Account < Sequel::Model plugin :class_table_inheritance end class TwitterAccount < Account; end class FacebookAccount < Account; end class…
Reid Main
  • 3,394
  • 3
  • 25
  • 42
4
votes
1 answer

How do I make Sequel treat column as an integer?

sequel interprets tinyint(1) fields as a boolean type. While reasonable most of the time, is there a way to get to the real integer value? mysql> CREATE TABLE t1 (f1 TINYINT(1)); mysql> INSERT INTO t1 VALUES (0), (1), (2); $ type…
x-yuri
  • 16,722
  • 15
  • 114
  • 161
4
votes
1 answer

How do I show a general_query log with Sequel gem in terminal

I have a webserver that uses Sinatra and the Sequel gem. I would like to know if it is possible to print every query executed into the console. I found in the Sequel documentation that I can setup a log file path. You can also specify optional…
Sean Larkin
  • 6,290
  • 1
  • 28
  • 43
4
votes
0 answers

SQLite3::IOException: disk I/O error on SELECT

I have a Sinatra application using the Sequel gem against a sqlite3 database. I've been developing on a MacBook Pro running Mavericks. I have been running the app locally using the shotgun gem and everything has been working just fine. Recently I…
jojoba
  • 181
  • 7
4
votes
1 answer

Sequel::AdapterNotFound: LoadError: cannot load such file -- win32ole

I am successfully able to connect to MySQL and Postgres database using 'sequel'. I want to connect to the SQL Server database from Ubuntu 12.04 to Windows machine. Using tiny-tds we can do that, but I want to use 'sequel' for connection Gem…
Ashwini
  • 2,449
  • 2
  • 29
  • 42
4
votes
1 answer

postgres encoding error in sidekiq app

I am working on an application where a ruby sidekiq process calls a 3rd party and parses the data into a database. I am using sequel ad my orm. I am getting some weird characters back in the results, for example: "Tweets en Ingl\xE9s y en…
dagda1
  • 26,856
  • 59
  • 237
  • 450
4
votes
1 answer

How to get records from SQLite in random order using the Sequel ORM?

Trying to convert this SQLite query SELECT * FROM `terms` ORDER BY RANDOM() LIMIT 10 to work with a Sequel model. The closest I got: Term.order(rand{}).limit(10) Term.order('random ()').limit(10) which translate into
Arman H
  • 5,488
  • 10
  • 51
  • 76