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
3
votes
3 answers

single quote escape inside double quotes using sequel fetch function in ruby

using raw SQL when I use the IN statement inside a query using sequel's fetch function, I can't escape a single quote by writing where stuff IN ... @values='stuff1\'','stuff2\'' db.fetch("query...where IN (?)", "#{@values}") outputs query...where…
Nothing
  • 99
  • 12
3
votes
1 answer

can't 'delete' in Ruby Sequel

I'm starting with the Sequel database library for Ruby. Given the following code: require 'sequel' db = Sequel.connect('sqlite://users.db') users = db[:users] users.first.delete Ruby throws the error: 'delete' : wrong number of arguments (0 for 1)…
cannotcompute
  • 397
  • 4
  • 17
3
votes
1 answer

Cannot connect to Postgres via Sequel

I am trying to use Padrino with Sequel and Postgres and am having no luck connecting. In my pg_hba.conf I set the postgres user to 'trust' so no password is required (and can log in using PgAdmin without a password). # TYPE DATABASE USER …
Lee
  • 8,354
  • 14
  • 55
  • 90
3
votes
1 answer

sequel migration error ,relation already exists?

I just created a new migration file for my ruby project (e.g. 003_foo3.rb) I use sequel 3.48. Test in local first $sequel -m ~/myproject/db/migration postgres://postgres@localhost/myproject_db Error: Sequel::DatabaseError: PG::Error: ERROR: …
mhd
  • 4,561
  • 10
  • 37
  • 53
3
votes
0 answers

How to use Virtus with Sequel or ROM?

I've started using DataMapper in my project, then I've found out that it is actually a frozen project. DataMapper 2.0 moved to ROM (Ruby Object Mapper), however the Property API from DataMapper was extracted to Virtus project. What I need is to keep…
Michał Fita
  • 1,183
  • 1
  • 7
  • 24
3
votes
1 answer

Ruby and MySQL UTF-8 characters

I'm switching a Sinatra application from SQLite3 to MySQL. For some reason, which I can't understand, when I extract data from the MySQL using Ruby and Sequel the characters appear in 8-BIT ASCII instead of UTF-8. The deployment environment is a…
patm
  • 1,420
  • 14
  • 19
3
votes
1 answer

Where to store column descriptions with an ORM (especially Sequel)?

When I use an ORM like Sequel, the columns of a Model are defined by the connected database. How can I get a documentation for the columns of the table? Example (Sequel, but I think the principle is the same for AR): I create a table with this…
knut
  • 27,320
  • 6
  • 84
  • 112
3
votes
1 answer

Sequel: How to get the data type of a column of a Dataset

How can I get the data type of a column of a Dataset. Or more general: How to get the schema of a dataset? Imagine I have the following situation: require 'sequel' DB = Sequel.sqlite() DB.create_table(:data){ nvarchar :key timestamp…
knut
  • 27,320
  • 6
  • 84
  • 112
3
votes
1 answer

Force sequel to log queries to the same destination as sinatra

I want initialize Sequel in my Sinatra app with DB = Sequel.sqlite '...', :loggers => [SomeLogger] and I want Sequel to log to the same destination as Sinatra. But it seems like Sinatra logger is available only during request handling (only in…
Aleksei Chernenkov
  • 991
  • 1
  • 8
  • 23
3
votes
2 answers

How do I combine AND and OR using Sequel?

I want to generate a SQL query like the following using Ruby's Sequel: SELECT * FROM Objects WHERE (color = "red" AND shape = "triangle") OR (color = "blue" AND shape = "square") OR (color =…
Ben P
  • 31
  • 2
3
votes
2 answers

Tools or patch for Ruby Sequel or ORM instrumenting SQL queries for slow query log analysis

We have MySQL slow query logs from a suite of applications, mostly in Ruby, some using Rails ActiveRecord, others using Sequel. We'd love to be able to easily track a particular (MySQL) slow query back to the code which generated it. Is there a…
Jim Dennis
  • 17,054
  • 13
  • 68
  • 116
3
votes
1 answer

Capturing Sequel::Error exceptions

I have a Sinatra app utilizing Sequel and Postgres... it's a very simple module that inserts into a database. I want to capture any errors from the insert and return a useful message. My codes is as follows: begin sql = DB["INSERT INTO table…
Dan Brooking
  • 134
  • 1
  • 10
3
votes
1 answer

Single Table Inheritance in Sequel::Model (Ruby ORM)

I have a table in my database called providers with a type column called provider_type. provider_type can be either of the following: center sponsor I want to create a class that inherits from Sequel::Model called Center and one called Sponsor,…
Patrick Klingemann
  • 8,884
  • 4
  • 44
  • 51
3
votes
2 answers

How do I create a Sequel migration from an existing postgres table dump?

I am wondering the best way to create a migration in sequel that is based on an existing table dump from postgres. I realise that I will have to write the down method myself to remove the table / functions / sequences, but is there a way to tell…
kelso
  • 394
  • 1
  • 2
  • 11
2
votes
1 answer

Heroku db:push -> Missing Sequel gem

I'm trying to push my local MySQL database to Heroku's ClearDB MySQL database. I've gone through a lot of errors of missing gems and such, and am getting stuck on one. I'm running: heroku db:push mysql://user:password@localhost/db It prompts me…
jwegner
  • 7,043
  • 8
  • 34
  • 56