Re: trailing whitespace

2013-10-29 Thread Joe Van Dyk
On Friday, September 20, 2013 7:27:24 AM UTC-7, Maximilian Haack wrote: While browsing the source code of sequel, I noticed that there is quite a bit of trailing whitespace in the code base. Since I'm usually navigating block-wise through code, I found this a bit annoying and set out to

Re: Using the AR connection

2012-11-23 Thread Joe Van Dyk
On Friday, April 16, 2010 12:42:48 PM UTC-7, Jeremy Evans wrote: On Apr 16, 12:24 pm, Brian Takita brian.tak...@gmail.com wrote: Hello, I'm using Friendly in my Rails application. Currently there is one db connection for ActiveRecord and one db connection for Sequel. I would like my

Re: Three-way associations

2012-07-15 Thread Joe Van Dyk
On Thursday, July 12, 2012 1:08:21 PM UTC-6, Jamie Hodge wrote: I was asking if the records and joins tables could be structured in a manner that better embodied the business logic, i.e. a way in which it was impossible for an approval record to exist without an accompanying item and

Re: Case insensitivity and unique validations.

2012-07-12 Thread Joe Van Dyk
On Saturday, July 7, 2012 5:25:31 PM UTC-6, cult hero wrote: I've been looking for the best way to deal with that amounts to a case insensitive column in PostgreSQL. (It stores email addresses.) I've found a couple of options (an index using lower() and triggers using lower()) but is there

Re: Combining datasets

2012-07-12 Thread Joe Van Dyk
On Saturday, July 7, 2012 3:43:48 PM UTC-6, Jeremy Evans wrote: On Saturday, July 7, 2012 2:09:43 PM UTC-7, Joe Van Dyk wrote: Given the following: buyable = DB[:product_listings].where(:buyable = true) recent = DB[:product_listings].where

Re: Combining datasets

2012-07-12 Thread Joe Van Dyk
On Thursday, July 12, 2012 1:42:52 AM UTC-6, Joe Van Dyk wrote: On Saturday, July 7, 2012 3:43:48 PM UTC-6, Jeremy Evans wrote: On Saturday, July 7, 2012 2:09:43 PM UTC-7, Joe Van Dyk wrote: Given the following: buyable = DB[:product_listings].where(:buyable = true

Combining datasets

2012-07-07 Thread Joe Van Dyk
Given the following: buyable = DB[:product_listings].where(:buyable = true) recent = DB[:product_listings].where(start_sale_date now() - interval '1 day') What's the best way to find all recent buyable products? (Ideally, without using

Combining datasets

2012-07-07 Thread Joe Van Dyk
Given the following: buyable = DB[:product_listings].where(:buyable = true) recent = DB[:product_listings].where(start_sale_date now() - interval '1 day') What's the best way to find all recent buyable products? (Ideally, without using

Sharing same postgresql parser with ActiveRecord

2012-06-01 Thread Joe Van Dyk
Hi, There's been lots of activity in the postgresql world in the past couple years. Arrays, hstores, ranges, json, etc. AR's postgresql adapter in 4.0 will have support for mapping ruby types to custom postgresql types (https://github.com/rails/rails/pull/4775). I've noticed that sequel,

Re: Sharing same postgresql parser with ActiveRecord

2012-06-01 Thread Joe Van Dyk
On Friday, June 1, 2012 10:47:20 AM UTC-7, Jeremy Evans wrote: On Friday, June 1, 2012 10:07:03 AM UTC-7, Joe Van Dyk wrote: Hi, There's been lots of activity in the postgresql world in the past couple years. Arrays, hstores, ranges, json, etc. AR's postgresql adapter in 4.0 will have

Managing database changes

2012-03-29 Thread Joe Van Dyk
I'm starting to move more logic into the database, using triggers, views, functions, CTEs, etc. When plv8/json comes out for postgres, I can see myself putting lots of logic in there. I'm having problems with the standard way of doing database migrations in sequel and activerecord. Both

Re: Managing database changes

2012-03-29 Thread Joe Van Dyk
haven't tried it yet though. Joe On Thursday, March 29, 2012 12:11:26 PM UTC-7, Joe Van Dyk wrote: I'm starting to move more logic into the database, using triggers, views, functions, CTEs, etc. When plv8/json comes out for postgres, I can see myself putting lots of logic in there. I'm

Using sequel in rails

2011-11-22 Thread Joe Van Dyk
Hi, Is anyone using Sequel in Rails 3.1? The Rails plugins at http://sequel.rubyforge.org/plugins.html didn't seem to work out of the box for me, I had to modify them some. Here are my changes to the sequel-rails one: https://github.com/joevandyk/sequel-rails/commits/master Thanks, Joe --

Accessing sequel dataset results with dots

2011-11-22 Thread Joe Van Dyk
Is it possible to access sequel dataset results with dots, instead of : [] ? i.e. DB[:table].each do |row| puts row.col1 end instead of DB[:table].each do |row| puts row[col1] end -- You received this message because you are subscribed to the Google Groups sequel-talk group. To post to

Using grep in join conditions

2011-11-22 Thread Joe Van Dyk
I've got a query like: select table1.* from table1 inner join table2 on table2.table1_id = and (table2.name ilike '%blah %' or table2.name ilike '%foo%') How can I write this in Sequel syntax? I know I can use Dataset#grep to add conditions to the where clause, but not sure how to add

Sequel support of postgresql arrays

2011-09-21 Thread Joe Van Dyk
Does sequel support postgresql arrays? What about arrays of custom types? If not, what would it take to get that? I found https://github.com/gucki/sequel_column_type_array, but it's pretty incomplete. Thanks, Joe -- You received this message because you are subscribed to the Google Groups

Re: Sequel support of postgresql arrays

2011-09-21 Thread Joe Van Dyk
On Wed, Sep 21, 2011 at 3:28 PM, Jeremy Evans jeremyeva...@gmail.com wrote: On Sep 21, 1:57 pm, Joe Van Dyk joevan...@gmail.com wrote: Does sequel support postgresql arrays?  What about arrays of custom types? Sequel's built-in support for arrays is currently limited to the sql_subscript

Re: Postgresql prepared statement -- sequel documentation question

2011-09-17 Thread Joe Van Dyk
On Sep 16, 10:50 pm, Jeremy Evans jeremyeva...@gmail.com wrote: On Sep 16, 4:21 pm, Joe Van Dyk joevan...@gmail.com wrote: So there's no need to use the __type names anymore? There shouldn't be. I'm still a little confused. http://www.postgresql.org/docs/9.0/static/sql

Getting stuff directly from postgresql

2011-09-16 Thread Joe Van Dyk
I've got a query that returns a *lot* of data and I need it CSV formatted and returned to the user (in a browser). Postgresql can output stuff in CSV format, and it seems like it would be efficient to let postgresql format the result and return that result exactly as is to the user. Instead of

Re: Getting stuff directly from postgresql

2011-09-16 Thread Joe Van Dyk
On Sep 16, 1:57 pm, Michael Granger rubym...@gmail.com wrote: Joe Van Dyk wrote: I've got a query that returns a *lot* of data and I need it CSV formatted and returned to the user (in a browser). Postgresql can output stuff in CSV format, and it seems like it would be efficient to let

Getting an arbitrary amount of OR'd conditions

2011-09-16 Thread Joe Van Dyk
I often need to do something like: def search *keywords select * from something where column ilike '%first-keyword%' OR column ilike '%second-keyword%' ..; end So, the query would contain an arbitrary amount of OR'd conditions, depending on how many keywords were passed in to the search

Postgresql prepared statement -- sequel documentation question

2011-09-16 Thread Joe Van Dyk
From http://sequel.rubyforge.org/rdoc/files/doc/prepared_statements_rdoc.html PostgreSQL If you are using the ruby-postgres or postgres-pr driver, PostgreSQL uses the default emulated support. If you are using ruby-pg, there is native support, but it may require type specifiers. This is easy if

Re: Postgresql prepared statement -- sequel documentation question

2011-09-16 Thread Joe Van Dyk
On Sep 16, 3:18 pm, Michael Granger rubym...@gmail.com wrote: Joe Van Dyk wrote:  Fromhttp://sequel.rubyforge.org/rdoc/files/doc/prepared_statements_rdoc.html PostgreSQL If you are using the ruby-postgres or postgres-pr driver, PostgreSQL uses the default emulated support. If you

Re: Postgresql prepared statement -- sequel documentation question

2011-09-16 Thread Joe Van Dyk
On Sep 16, 4:02 pm, Jeremy Evans jeremyeva...@gmail.com wrote: On Sep 16, 3:06 pm, Joe Van Dyk joevan...@gmail.com wrote: Fromhttp://sequel.rubyforge.org/rdoc/files/doc/prepared_statements_rdoc.html PostgreSQL If you are using the ruby-postgres or postgres-pr driver, PostgreSQL uses

Problem running migrations

2011-06-14 Thread Joe Van Dyk
$ bundle exec sequel -m migrations/ postgres://localhost/test Error: Sequel::Migrator::Error: No target version available/usr/local/ rvm/gems/ruby-1.9.2-p180-good/gems/sequel-3.24.1/lib/sequel/extensions/ migration.rb:427:in `initialize' $ cat migrations/first.rb Sequel.migration do up do

Re: Problem running migrations

2011-06-14 Thread Joe Van Dyk
Here is my code: https://github.com/joevandyk/sequel-playground On Jun 14, 4:04 pm, Joe Van Dyk joevan...@gmail.com wrote: $ bundle exec sequel -m migrations/ postgres://localhost/test Error: Sequel::Migrator::Error: No target version available/usr/local/ rvm/gems/ruby-1.9.2-p180-good/gems

Re: Problem running migrations

2011-06-14 Thread Joe Van Dyk
On Jun 14, 4:20 pm, Jeremy Evans jeremyeva...@gmail.com wrote: On Jun 14, 4:05 pm, Joe Van Dyk joevan...@gmail.com wrote: Here is my code:https://github.com/joevandyk/sequel-playground You aren't following the migration naming format.  first.rb is not a valid migration filename.  Use