sequel

When using Sequel ORM; when to use Core or Model?

I'm looking to expand my ruby knowledge beyond scripting, test code and file parsers by writing some web services. I'm thinking of using sequel as an ORM. What advantages are there to using Sequel Core or Sequel Model? What should I be looking out for? What rules of thumb are there for picking one or the other? ...

Ramaze with Sequel Migrations?

I'm trying to get migrations set up in Ramaze. I'm coming from doing mostly Rails stuff, but I wanted to give something else a shot. Anyway, I've got a directory in my project called "migrations" with a start.rb file and then my migrations. Here's start.rb: require File.expand_path('../app.rb', File.dirname(__FILE__)) require 'sequel/ex...

Sequel + Sinatra + Phusion Passenger + MySQL Connection Management

We are using Sinatra and Sequel for a small API implementation. The problem we have however is that on every page request Sequel opens new connections to MySQL, and keeps them open till they timeout, or you restart Apache. There's not a lot of documentation on how to reuse connections, so any help, explanations, and/or pointers in the r...

Using UTC with Sequel?

I'd like to not store times in my local timezone, but Sequel is making it really tough on me. I can set them to UTC before I put them in there (a bit of a pain), but then when I take them back out it assumes that they are local dates and then they are all 8 hours in the future. Is this something that hasn't been implemented yet? And if s...

Unable to connect mysql from Sequel gem

When i try to connect to mysql from sequel. I am getting below errors? can you help me? require 'rubygems' require 'sequel' DB = Sequel.connect(:adapter => 'mysql', :user => 'root', :host => 'localhost', :database => 'scanty',:password=>'xx') DB.tables Sequel::DatabaseConnectionError: NameError uninitialized ...

How can default values in Sequel Models be set?

Given the code below, how can default values be defined for the Model. (let's say the default for :name should be 'Thing'). require 'pp' require 'sequel' DB = Sequel.sqlite DB.create_table :items do primary_key :id String :name end items = DB[ :items ] class Item < Sequel::Model end Item.create :name => 'foobar' Item.create ...

Possible to substitute ORDER BY w/ other value if 1st value is empty

Is it possible to replace value field_id_36 with field_id_39 if field_id_36 is empty? SELECT wt.title, wt.url_title, wt.weblog_id, wt.entry_id, wd.field_id_36 FROM exp_weblog_titles wt LEFT JOIN exp_weblog_data wd ON wt.entry_id = wd.entry_id WHERE wt.weblog_id = {weblog_id_insert} ORDER BY field_id_36+0 So in theo...

Sequel selecting too many columns

It seems like the default select for Sequel is "select *", which causes all kinds of problems when you add some joins. At the very least you end up with the wrong ids in your objects (because there will then be more than one "id" column returned). Doing something like .select("people.*") would seem to work, but that treats the string ...

Sequel in conjunction with ActiveRecord any gotchas?

I'm considering using Sequel for some of my hairier SQL that I find too hard to craft in Active Record. Are there any things I need to be aware of when using Sequel and ActiveRecord on the same project? (Besides the obvious ones like no AR validations in sequel etc...) ...

Ruby approach to data access available in IronRuby

Coming from the Ruby community and approching IronRuby for desktop application development, I have little interest in using a .NET based ORM such as Linq. I want to use the ruby-way of data access that I've come to love from products such as ActiveRecord, DataMapper, and Sequel. After much searching I ran into a brick wall trying to ge...

What is a practical way to sync data in a directory to a database?

My situation involves a directory containing MP3 files, and a database that should contain all the MP3 metadata (i.e. genres, artist names, album names, and track names) from the MP3 files in that directory. The database should always reflect what is in the directory, that is... the algorithm I'm searching for should never delete items f...

ruby sequel - file db from 2 apps

If I use Sequel in a ruby app like this: DB = Sequel.sqlite('testdb.db') does it make the database shared? Can I acces this same file from a different ruby app AT THE SAME TIME and get the database to perform locking etc? I'm thinking probably not and i'd have to actually have a separate instance of the database running. thanks ...

Sequel::Model: Where the methods like create_table come from?

I am trying to understand how Sequel works. The example below inherit from Sequel::Model and calls set_schema, create_table, etc. I was trying to find the documentation for these methods, but no luck on the rdoc for Sequel::Model: http://sequel.rubyforge.org/rdoc/classes/Sequel/Model.html Where are these methods coming from and how doe...

When to use an ORM (Sequel, Datamapper, AR, etc.) vs. pure SQL for querying

A colleague of mine is currently designing SQL queries like the one below to produce reports, which are displayed in excel files through an external data query. At present, only reporting processes on the DB are required (no CRUD operations). I am trying to convince him that it would be better to use a ruby ORM in order to be able to di...

How do I serialize data with Sequel and Ruby?

I have a table which should store an id, a name and a hash. How do I serialize the Hash? (I'm using Ruby and Sequel as ORM.) ...

Can ActiveRecord create tables outside of a migration?

I am working on a non Rails web app, so no migrations script by default. The Sequel ORM lets me create tables easily in a script: #!/usr/bin/env ruby require 'rubygems' require 'sequel' ## Connect to the database DB = Sequel.sqlite('./ex1.db') unless DB.table_exists? :posts DB.create_table :posts do primary_key :id varcha...

Best Ruby ORM for Wrapping around Legacy SQL Server Database?

Hi. 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, consistently named tables, etc in SQL Server. We're making all kinds of tools and stuff th...

access denied for user root, mysql database

when i am using sequel pro to connect to a remote database, the server says access denied. I am 100% percent sure that the username and password are correct. I also try to use phpmyadmin to connect to the server, it works. I don't know what happened when I am using sequel pro to connect to the server. ...

Sequel Migration not running up?

Having some trouble with the Migrations in Sequel and could use another set of eyes. I am running a migration that looks ok but no table is created. It is definitely connecting because I can see the schema_info table has been created. -M 0/1 changes the version as you would expect but still no table. The command: sequel -m . -M 1 ~/Des...

What ORM to use in one process multiple db connections sinatra application?

Checked ActiveRecord, DataMapper, Sequel: some use globals (static variables) some require open db connection before loading source file with models. What ORM is better to use in sinatra application that uses different databases. ...