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 do I get translated error messages in sequel?

I am using Sequel. How do I get ActiveModel-style translated errors? Example class User < Sequel::Model def validate super errors.add(:email, :invalid) end end @user = User.new @user.save # => false @user.errors.full_messages # =>…
iblue
  • 29,609
  • 19
  • 89
  • 128
0
votes
1 answer

Migration fails with Error: NoMethodError: undefined method `Migration'

I'm trying to get set up with Sequel in Ruby. I went to http://sequel.rubyforge.org/rdoc/files/doc/migration_rdoc.html and created my first migration. Then I got Postgres.app running as my server and did a createdb Qsario. The problem comes when…
Qsario
  • 1,016
  • 1
  • 9
  • 18
0
votes
3 answers

Ruby Sinatra + Sequel constraint error handling

What is the right way to handle exceptions coming from the model in Sequel? Particularly the thing I'm running into is when the unique constraint is applied to the login. The exception in this case appears to be coming from SQLite itself instead of…
Josh Voigts
  • 4,114
  • 1
  • 18
  • 43
0
votes
1 answer

Sequel making the following one query running an exclude from a join table

I have a users table and a blocked_users table. users has all my authentication data, site preferences, etc, and blocked_users has a source_id and a target_id. I would like to return a collection of all users that a user has not blocked and that…
jdkealy
  • 4,807
  • 6
  • 34
  • 56
0
votes
2 answers

Sequel - ordering a dataset for one-to-many and many-to-many model associations

I have a question regarding ordering datasets with sequel. I have tables 'jobs', 'users', 'comments'. Users can apply for any job, so I have a many-to-many association here (I also have a 'jobs_users' table). Jobs and comments represent one-to-many…
mie
  • 721
  • 5
  • 16
0
votes
1 answer

How to set default value to getdate() with sql server

I'm using the sequel ruby orm with sql server. I would like to know how to set the default value of a datetime field to the sql server function getdate() in a migration: create_table(:table) do primary_key :id datetime :last_update, null: false,…
Sylvain
  • 15
  • 2
0
votes
4 answers

Disadvantages of Sequel gem

Are there any alternatives to the Sequel ORM when working on a Sinatra-based app?
Subba Rao
  • 10,576
  • 7
  • 29
  • 31
0
votes
1 answer

Use a table in another database in Sequel::Model

I am using Sequel with MySQL database and Padrino. To get stats from my database I'm using: class Stats < Sequel::Model(:"#{OTHER_DB}__stats") end OTHER_DB is the name of the database where the stats table is located. Everything works fine and I'm…
softarn
  • 5,327
  • 3
  • 40
  • 54
0
votes
1 answer

does a sequel models generator exists?

I'm looking for a ruby class that could generate the sequel model file for Ramaze after reading the definition of the table in a mySQL database. For example, I would like to type : ruby mySuperGenerator.rb "mytable" And the result shold be the…
Pierre-Gilles Levallois
  • 4,161
  • 4
  • 28
  • 37
-1
votes
1 answer

using Query one results to run Query two

SELECT distinct Pd.Cpd as ' accountnumber' FROM [RQL_ALK_PMT].[Cts_opps] pd INNER JOIN [RQL_ALK_PMT].[Cts_opps].dpo.cnms_id metg on metg.cnms_id=me.cnms_id This code would result with this Result accountnumber …
-1
votes
1 answer

In sql I want to a query in which it gives me the duplicates. However, i would like to see the duplicates side by side. Instead of just count

Select employee.id,count(employee. Id), employee.name From employee_database Group by employee.id, employee.name Having count (employee.id) >1
-1
votes
1 answer

How to connect to MySQL via Ruby's "mysql2" gem?

I installed a fresh MySQL instance and tried connecting to the instance via MySQL Workbench (using the IP address, default port, username / password). The connection was successful. So these values are correct. I then created a new db schema "newDB"…
Mugen
  • 1,417
  • 5
  • 22
  • 40
-1
votes
1 answer

Sequel Ruby reading bytea data type

I am trying to decode a json mime type stored in bytea column in postgres using sequel. I remember I used some kind of method passing it mime type and data. But I cannot find it in my code and documentation. I have bytea column and info about mime…
Levi
  • 77
  • 7
-1
votes
1 answer

import large .SQL files with Ruby sequel gem

I am Looking to import(Rather run the schema.sql and seed.sql) in to the SQL server database using sequel gem. Is it possible with the gem? I did some very basic things like creating a database, running few queries etc. But Can not find any example…
jnan
  • 23
  • 4
-1
votes
1 answer

How to order association in descending order in Sequel

Given this class class User < Sequel::Model one_to_many :rounds, order: :date end What I'm trying to do is sort by descending date. I tried this like ActiveRecord supports, but that is not the way to go. one_to_many :rounds, order: date:…
Eyeslandic
  • 14,553
  • 13
  • 41
  • 54
1 2 3
51
52