S
Sharon Rosner
Sequel version 0.1.9.7 has just been released. This release includes a
number of big fixes, as well as convenience methods for opening
databases and a new method for batch inserting records. Following is a
discussion of the main changes:
New Dataset#multi_insert for batch inserting records
====================================================
The new Dataset#multi_insert method lets you process batch insertions
with ease. The records are supplied to the method as an array of
hashes, and the inserts are wrapped in a transaction. Here's an
example:
DB[:items].multi_insert(records)
You can also specify a :commit_every option that causes the method to
split the records array into batches that will be inserted using
separate transactions:
DB[:items].multi_insert(records, :commit_every => 1000)
Using the :commit_every option when inserting a large amount of
records can greatly improve performance and is highly recommended.
(Thanks to Victor "Zverok" Shepelev for suggesting this feature.)
Convenience Methods for Opening Databases
=========================================
The solution for opening DBI databases has now been generalized, with
each adapter having its own convenience method, so you don't need to
use URI's anymore:
# open a memory SQLite database
DB = Sequel.sqlite
# open a regular SQLite database
DB = Sequel.sqlite('test.db')
# open a postgres database
DB = Sequel.postgres('mydb')
# open a postgres database with options
DB = Sequel.postgres('mydb', :user => 'myuser')
Bug Fixes and Miscellanea
=========================
* Added support for executing batch statements in the sqlite adapter.
* Changed #current_page_record_range to return 0..0 for an invalid
page.
* Aliased tables are now joined properly, e.g.: DB['stats
s'].join('player p', :id =>
layer_id)
* Improved Symbol#to_field_name to prevent false positives. Since
symbols are also used to signify SQL literals, this could help in some
cases where they were converted to dot notation by mistake.
=============================================
Sequel project page:
<http://code.google.com/p/ruby-sequel>
Sequel documentation:
<http://sequel.rubyforge.org>
Join the Sequel-talk group:
<http://groups.google.com/group/sequel-talk>
Install the gem:
sudo gem install sequel
Or check out the source and install manually:
svn co http://ruby-sequel.googlecode.com/svn/trunk sequel
cd sequel
rake install
number of big fixes, as well as convenience methods for opening
databases and a new method for batch inserting records. Following is a
discussion of the main changes:
New Dataset#multi_insert for batch inserting records
====================================================
The new Dataset#multi_insert method lets you process batch insertions
with ease. The records are supplied to the method as an array of
hashes, and the inserts are wrapped in a transaction. Here's an
example:
DB[:items].multi_insert(records)
You can also specify a :commit_every option that causes the method to
split the records array into batches that will be inserted using
separate transactions:
DB[:items].multi_insert(records, :commit_every => 1000)
Using the :commit_every option when inserting a large amount of
records can greatly improve performance and is highly recommended.
(Thanks to Victor "Zverok" Shepelev for suggesting this feature.)
Convenience Methods for Opening Databases
=========================================
The solution for opening DBI databases has now been generalized, with
each adapter having its own convenience method, so you don't need to
use URI's anymore:
# open a memory SQLite database
DB = Sequel.sqlite
# open a regular SQLite database
DB = Sequel.sqlite('test.db')
# open a postgres database
DB = Sequel.postgres('mydb')
# open a postgres database with options
DB = Sequel.postgres('mydb', :user => 'myuser')
Bug Fixes and Miscellanea
=========================
* Added support for executing batch statements in the sqlite adapter.
* Changed #current_page_record_range to return 0..0 for an invalid
page.
* Aliased tables are now joined properly, e.g.: DB['stats
s'].join('player p', :id =>
* Improved Symbol#to_field_name to prevent false positives. Since
symbols are also used to signify SQL literals, this could help in some
cases where they were converted to dot notation by mistake.
=============================================
Sequel project page:
<http://code.google.com/p/ruby-sequel>
Sequel documentation:
<http://sequel.rubyforge.org>
Join the Sequel-talk group:
<http://groups.google.com/group/sequel-talk>
Install the gem:
sudo gem install sequel
Or check out the source and install manually:
svn co http://ruby-sequel.googlecode.com/svn/trunk sequel
cd sequel
rake install