Sequel is a ruby gem providing a simple, flexible, powerful and lightweight SQL database access toolkit for Ruby
Questions tagged [sequel-gem]
29 questions
3
votes
1 answer
How to using json fields inside where statement in Sequel?
I have a table transactions
id | bigint | NOT NULL DEFAULT nextval('transactions_id_seq'::regclass)
transaction_id | bigint | NOT NULL
middleware_id | text |
opname …

Dimitri
- 623
- 7
- 14
3
votes
4 answers
Multiple aggregate queries using the sequel gem
Is it possible to use sequel to execute a query like this:
select (select count(*) from users where blah = 'blah') as "users",
(select count(*) from contacts where blah = 'blah') as "contacts"
I know I can execute these queries one a time…

dagda1
- 26,856
- 59
- 237
- 450
2
votes
3 answers
How to generate SQL statements from Sequel migrations
I would like to output the generated SQL statements from Sequel migrations to a file without having a connection to the actual database.
I need this because I want to export the statements in MySQL form, but I use PostgreSQL normally.
I could try…

farukg
- 523
- 4
- 12
2
votes
1 answer
Using Padrino with Sequel, Can Migrations Create Singularly Named SQL Tables?
I'm looking to build an application using the Padrino Framework with Sequel as my ORM. The problem is that I need to interface with an existing database which was created using singularly named tables. Rather than renaming the SQL tables (as other…

kkirsche
- 1,217
- 2
- 15
- 38
2
votes
1 answer
How to make TIMESTAMP WITH TIME ZONE column with Ruby Sequel?
I am learning Ruby and Sequel, and trying to make some table.
I want to save my time value as in UTC in PostgreSQL database. So I made a table with
db.create_table :TestTable1 do
Timestamp :field1
end
but I got
field1 | timestamp without…

eonil
- 83,476
- 81
- 317
- 516
1
vote
0 answers
Sequel gem - "FATAL: remaining connection slots are reserved for non-replication superuser connections"
From googling, I know this error seems to be due to connections not being closed properly. However, the way the Sequel gem readme says to use a database is to open a connection using @db = Sequel.connect('postgres://someaddress') and then call…

Max
- 597
- 7
- 21
1
vote
2 answers
Sequel gem copy database to another with username and password
From the section to copy another use is to use
sequel -C mysql://host1/database postgres://host2/database2
Is there a way to include username and password for both databases.
Tried with no luck
sequel -C mysql://user:password@host1/database…

Maged Makled
- 1,918
- 22
- 25
1
vote
1 answer
Ruby Sequel migrations running, but fail to add columns
I am using the Heroku Postgres addon for my DB (basic version). Ruby Sequel is my ORM for schema management.
Recently, some migrations have not updated the DB schema.
I run migration 19, 019_add_last_unique_story_to_user.rb:
Sequel.migration do
…

jdmcpeek
- 145
- 2
- 8
1
vote
1 answer
Rspec with database_cleaner on Sequel causes foreign key truncation error
I'm running RSpec tests with DatabaseCleaner on the following Sequel models
class User < Sequel::Model
one_to_many :memberships
many_through_many :accounts, [[:memberships, :user_id, :account_id]]
end
class Account < Sequel::Model
…

RedFred
- 999
- 9
- 20
1
vote
2 answers
How to return updated records using Sequel Gem on a bulk update
I am using the Sequel gem to bulk update Users in MySql.
users = Users.filter(:id => ids).all
raise if users.nil?
updated_users = Users.filter(:id => addon_ids).update({deleted: 1, moderator_id: moderator_id})
p updated_users
# => 3
According to…

Alex Pan
- 4,341
- 8
- 34
- 45
1
vote
2 answers
Disable double underscore behaviour for Sequel
How disable double underscore behaviour for Sequel?
I work with legacy data base schema where I have a lot of columns with "__" in name.
db[:abc].insert({vector_a__c: "356"})
Sequel::DatabaseError: PG::UndefinedColumn: ERROR: column "vector_a" of…

Anton Senik
- 41
- 5
1
vote
1 answer
Add look-up associations and column aliases to Sequel model
I would like to include 'look-up' values from a table that is associated (two relationship) with the primary table. I'm working with a legacy database.
Primary table:
CREATE TABLE foo_table (
id INT PRIMARY KEY NOT NULL,
name VARCHAR(255),
…

craig
- 25,664
- 27
- 119
- 205
1
vote
1 answer
Cant call .all on dataset
I am running into problems when changing a query from plain sql (note: I am not using AR but sequel)
So this works:
Post.fetch(
"SELECT
COUNT(*) as count, HOUR(created_at) as date, class_type
FROM
tours t
WHERE
…

tomr
- 1,134
- 2
- 10
- 25
0
votes
1 answer
Ruby Sequel Gem unable to look up tables with different owner
I'm connecting to my company's database with the Sequel Gem using the odbc adaptor.
DB = Sequel.odbc('myserver', :user => "USER1", :password => "1234")
I connected fine but I was not able to get the dataset off of tables that belongs to other…

Evilmuffin
- 214
- 4
- 14
0
votes
1 answer
Why is SQL developer ID column return me BigDecimal instead of simple integer?
I'm using the sequel gem to read a SQL server database table.
Before I do that, I connect to the SQL server database using Oracle SQL developer, and the id column shows 1, 2, 3, 4, 5...
The table definition looks like this in SQL Developer:
But…

Henry Yang
- 2,283
- 3
- 21
- 38