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

I want to do an autocomplete with Ruby and Sequel

I am using Sequel with prostgres and Sinatra. I want to do an autocomplete search. I’ve verified my jQuery which sends a GET works fine. The Ruby code is: get '/search' do search = params[:search] DB[:candidates].select(:last).where('last LIKE…
user1903663
  • 1,713
  • 2
  • 22
  • 44
0
votes
2 answers

Heroku db:pull error LoadError: cannot load such file — sqlite3 (Sequel::AdapterNotFound)

I'm having the same problem as this person: Heroku db:pull error "LoadError: cannot load such file -- sqlite3 (Sequel::AdapterNotFound)" Where I cannot pull my database from heroku. However gem install sqlite3, gem install taps, and installing…
ThinQtv
  • 103
  • 1
  • 1
  • 11
0
votes
1 answer

will _paginate not paging with SEQUEL

I am struggling with this. Using sinatra, ruby and Sequel, I attempting to implement paging. The query is: @items = DB[:candidates].order(:id).paginate(1, 10) which works,it produces the desired number of records and the <%= will_paginate(@items)…
user1903663
  • 1,713
  • 2
  • 22
  • 44
0
votes
1 answer

Does Sequel not support filtering after results?

The following query is working in Sequel: table_sizes = db_config["SELECT table_name,table_rows / 1000000 as table_rows, data_length / 1000000 as data_length, index_length / 1000000 as index_length,round(((data_length + index_length) / 1024 / 1024 /…
Pratik Bothra
  • 2,642
  • 2
  • 30
  • 44
0
votes
2 answers

Detect duplicate records using Sequel and PostgreSQL

I want to check to see if the email address that a new person uses when registering is a duplicate of an existing record. Here is the code: post '/signup' do email_address = params['email_address'] username = params['username'] password…
user1903663
  • 1,713
  • 2
  • 22
  • 44
0
votes
1 answer

When using Sinatra and Sequel, my update query doesn't get executed

I am attempting to do an inline (i.e. not using a form and not going to another page) update (and, separately but same problem, delete) of a record. I am using ruby, sinatra and SEQUEL with postgres. The jquery script is as…
user1903663
  • 1,713
  • 2
  • 22
  • 44
0
votes
1 answer

How do I access an in-memory database using Sequel.sqlite?

I am accessing the in-memory database using Sequel in a Sinatra application. I want to access the in-memory database used in my application from the command line on my local host, as well as Heroku. Is there a way to access the in-memory database…
Apoorv Saxena
  • 4,086
  • 10
  • 30
  • 46
0
votes
1 answer

How to implement Active Record like 'find' method in Sinatra and Sequel?

I am building a simple Sinatra app for training purposes. I am using the Sequel gem and don't want to use Active Record. My files are: /models/idea.rb: class Idea attr_reader :id, :title, :description def initialize(input) @id = input[:id] …
Przemek Mroczek
  • 357
  • 1
  • 11
0
votes
1 answer

How to get rid of sequel error in sequel?

here's my code: init file: require 'sequel' DB = Sequel.connect('sqlite://data.db') DB.drop_table?(:restaurants) DB.create_table :restaurants do primary_key :id String :name end DB.drop_table?(:category) DB.create_table :category do primary_key…
0
votes
1 answer

get block returned by yield

Let's say you have such method: def log_yield(sql, args=nil) sql = "#{sql}; #{args.inspect}" if args t0 = Time.now begin yield rescue => e log_exception(e, sql) raise ensure t1 = Time.now …
LetMeSOThat4U
  • 6,470
  • 10
  • 53
  • 93
0
votes
1 answer

Sequel: Why isn't the save method saving?

I must be missing something super simple here. In the rspec code below, the second assertion is failing, the one where the code should have been set to true: describe "#redeem!" do it "marks a code as redeemed" do existing_code =…
Jonah
  • 15,806
  • 22
  • 87
  • 161
0
votes
1 answer

how to use locale messages in Sequel model validation

I'm using the plugin :validation_helpers with Sequel::Model: class User < Sequel::Model plugin :validation_helpers def validate super validates_presence [:name, :mail] end end When I show the the validation errors, the English…
Miguel Prz
  • 13,718
  • 29
  • 42
0
votes
1 answer

MySQL SELECT FOR UPDATE Lock block all threads?

I just wonder mysql "SELECT FOR UPDATE" lock block all my threads in a process, and how to by pass it if I need to grant this lock in multi-threaded Applications. To keep it simple, I just give a simple test code in ruby: t1 = Thread.new do db =…
Simon Iong
  • 191
  • 3
  • 9
0
votes
1 answer

Retrieving rows from in sequel gem

i am trying to retrieve a row from a dataset my model class is require 'sequel' class Item < Sequel::Model end and one my hello.rb file is require "rubygems" require './post' require "sequel" require './item' # connect to an in-memory database #DB…
mathlearner
  • 7,509
  • 31
  • 126
  • 189
0
votes
1 answer

Inserting validation constraints using Sequel gem in PostgreSQL database

I am new to Sequel, using it for the first time. I created a table: # connect to an in-memory database DB = Sequel.connect('postgres://ritesh:newpassword@localhost') # create an items table DB.create_table :items do primary_key :id String…
mathlearner
  • 7,509
  • 31
  • 126
  • 189