Re: SQLite3::BusyException

2015-04-03 Thread Jeremy Evans
On Friday, April 3, 2015 at 9:18:39 PM UTC-7, Hiroyuki Sato wrote:
>
> Hello jeremy.
>
> Thank you for your comment.
>
> I wrote test program. 
> It run two readers and writers. It access same table. 
>
> Almost operation complete < 0.005 sec. 
> But sometime raise SQLite3::BusyException. 
> so It take over 5sec. (red part). 
>
> I have no idea why this operation lock database over 5sec. 
>
> That's why I decrease max_connection to 1. 
> If I changed max_connections to 1. It works good. 
>
> --
> Hiroyuki Sato.
>
>
> 2015年4月4日土曜日 0時28分22秒 UTC+9 Jeremy Evans:
>
> On Friday, April 3, 2015 at 2:49:46 AM UTC-7, Hiroyuki Sato wrote:
>
> Hello members.
>
> Question
>
>   I'm using Sequel with Celluloid(https://celluloid.io)
>   Celluloid is a multithread library for Ruby.
>   
>   And SQLite db is the file database. not on-memory db.
> 
>   I got SQLite3::BusyException, so I would like to avoid this exception.
>   
>   It is possible to access sqlite db from one thread at once?
>   Or should I access to sqlite from one thread?
>   
>   I changed those values , It seems good. 
> max_connections: 1
> pool_timeout: 10
>   
>   Should I change another parameters?
>   
>   Is there any best practice configuration for connect sqlite3 with multi 
> thread?
>
>
> If you are only running a single process and you don't mind blocking 
> queries in other threads (basically serializing access to the database), 
> that should be fine.
>
> For anything involving multithread or multiprocess access, it may be 
> better to set a higher busy timeout on the underlying connection objects 
> via the :timeout option (the default is 5000 milliseconds).
>
> Thanks,
> Jeremy
>
>
>
> Sequel.migration do
>
>  change do
>
>create_table(:artists) do
>
>  primary_key :id
>
>  String :name, :null=>false
>
>end
>
>  end
>
> end
>
>
>
>
> require 'celluloid'
>
> require 'sequel'
>
> require 'sqlite3'
>
> require 'logger'
>
>
> logger = Logger.new(STDERR)
>
> logger.level = Logger::DEBUG
>
>
> DB = Sequel.connect(:adapter=>'sqlite',
>
>:database=>'/tmp/test.db')
>
> DB.loggers << logger
>
> Celluloid.logger = logger
>
> DB[:artists].delete
>
>
>
>
> class Reader
>
>  include Celluloid
>
>  include Celluloid::Logger
>
>  def initialize
>
>every(1){ run_sql }
>
>  end
>
>   def run_sql
>
> artists = DB[:artists]
>
>bfr = Time.new
>
>begin
>
>  artists.where( :id => 1 ).first
>
>  est = Time.new - bfr
>
>  debug "--> read #{est}sec #{Actor.current}"
>
>rescue
>
>   est = Time.new - bfr
>
>  debug "--> read(#{$!}) #{est}sec #{Actor.current}"
>
>  STDERR.puts $!.backtrace
>
> end
>
>  end
>
> end
>
>
>
> class Writer
>
>  include Celluloid
>
>  include Celluloid::Logger
>
>  def initialize
>
>every(1){ run_sql }
>
>  end
>
>   def run_sql
>
> artists = DB[:artists]
>
>name = sprintf("test%f",Time.new.to_f)
>
>bfr = Time.new
>
>begin
>
>  DB.transaction do 
>
> artists.insert( :name => name )
>
>est = Time.new - bfr
>
>debug "--> write #{est}sec #{Actor.current}"
>
>  end
>
>rescue
>
>  est = Time.new - bfr
>
>  debug "--> write(#{$!}) #{est}sec #{Actor.current}"
>
>  STDERR.puts $!.backtrace
>
>end
>
>   end
>
> end
>
>
>
>
>
> manager = Celluloid::SupervisionGroup.run!
>
>
>
> manager.pool(Writer, as: :writer, args: [], size: 2)
>
> manager.pool(Reader, as: :reader, args: [], size: 2)
>
>
>
> sleep
>
>
>
>
> I, [2015-04-04T12:49:34.936240 #45666]  INFO -- : (0.000677s) PRAGMA 
> foreign_keys = 1
> I, [2015-04-04T12:49:34.936358 #45666]  INFO -- : (0.28s) PRAGMA 
> case_sensitive_like = 1
> I, [2015-04-04T12:49:34.936914 #45666]  INFO -- : (0.000485s) SELECT 
> sqlite_version()
> I, [2015-04-04T12:49:34.938964 #45666]  INFO -- : (0.001836s) DELETE FROM 
> `artists` WHERE (1 = 1)
> I, [2015-04-04T12:49:35.944744 #45666]  INFO -- : (0.000109s) BEGIN
> I, [2015-04-04T12:49:35.947201 #45666]  INFO -- : (0.001993s) INSERT INTO 
> `artists` (`name`) VALUES ('test1428119375.944484')
> D, [2015-04-04T12:49:35.947593 #45666] DEBUG -- : --> write 0.002763sec 
> #
> I, [2015-04-04T12:49:35.948436 #45666]  INFO -- : (0.000281s) PRAGMA 
> foreign_keys = 1
> I, [2015-04-04T12:49:35.950077 #45666]  INFO -- : (0.001104s) COMMIT
> I, [2015-04-04T12:49:35.950211 #45666]  INFO -- : (0.39s) PRAGMA 
> case_sensitive_like = 1
> I, [2015-04-04T12:49:35.950584 #45666]  INFO -- : (0.000125s) BEGIN
> I, [2015-04-04T12:49:35.951233 #45666]  INFO -- : (0.000234s) PRAGMA 
> foreign_keys = 1
> I, [2015-04-04T12:49:35.951347 #45666]  INFO -- : (0.47s) PRAGMA 
> case_sensitive_like = 1
> I, [2015-04-04T12:49:35.951766 #45666]  INFO -- : (0.000309s) SELECT * 
> FROM `artists` WHERE (`id` = 1) LIMIT 1
> I, [2015-04-04T12:49:35.952320 #45666]  INFO -- : (0.000332s) INSERT INTO 
> `artists` (`name`) VALUES ('test1428119375.947833')
> D, [2015-04-04T12:49:35.952678 #45666] DEBUG -- : --> write 0.004531sec 
> #

Re: SQLite3::BusyException

2015-04-03 Thread Hiroyuki Sato
Hello jeremy.

Thank you for your comment.

I wrote test program. 
It run two readers and writers. It access same table. 

Almost operation complete < 0.005 sec. 
But sometime raise SQLite3::BusyException. 
so It take over 5sec. (red part). 

I have no idea why this operation lock database over 5sec. 

That's why I decrease max_connection to 1. 
If I changed max_connections to 1. It works good. 

--
Hiroyuki Sato.


2015年4月4日土曜日 0時28分22秒 UTC+9 Jeremy Evans:
>
> On Friday, April 3, 2015 at 2:49:46 AM UTC-7, Hiroyuki Sato wrote:
>>
>> Hello members.
>>
>> Question
>>
>>   I'm using Sequel with Celluloid(https://celluloid.io)
>>   Celluloid is a multithread library for Ruby.
>>   
>>   And SQLite db is the file database. not on-memory db.
>> 
>>   I got SQLite3::BusyException, so I would like to avoid this exception.
>>   
>>   It is possible to access sqlite db from one thread at once?
>>   Or should I access to sqlite from one thread?
>>   
>>   I changed those values , It seems good. 
>> max_connections: 1
>> pool_timeout: 10
>>   
>>   Should I change another parameters?
>>   
>>   Is there any best practice configuration for connect sqlite3 with multi 
>> thread?
>>
>
> If you are only running a single process and you don't mind blocking 
> queries in other threads (basically serializing access to the database), 
> that should be fine.
>
> For anything involving multithread or multiprocess access, it may be 
> better to set a higher busy timeout on the underlying connection objects 
> via the :timeout option (the default is 5000 milliseconds).
>
> Thanks,
> Jeremy
>


Sequel.migration do

 change do

   create_table(:artists) do

 primary_key :id

 String :name, :null=>false

   end

 end

end




require 'celluloid'

require 'sequel'

require 'sqlite3'

require 'logger'


logger = Logger.new(STDERR)

logger.level = Logger::DEBUG


DB = Sequel.connect(:adapter=>'sqlite',

   :database=>'/tmp/test.db')

DB.loggers << logger

Celluloid.logger = logger

DB[:artists].delete




class Reader

 include Celluloid

 include Celluloid::Logger

 def initialize

   every(1){ run_sql }

 end

  def run_sql

artists = DB[:artists]

   bfr = Time.new

   begin

 artists.where( :id => 1 ).first

 est = Time.new - bfr

 debug "--> read #{est}sec #{Actor.current}"

   rescue

  est = Time.new - bfr

 debug "--> read(#{$!}) #{est}sec #{Actor.current}"

 STDERR.puts $!.backtrace

end

 end

end



class Writer

 include Celluloid

 include Celluloid::Logger

 def initialize

   every(1){ run_sql }

 end

  def run_sql

artists = DB[:artists]

   name = sprintf("test%f",Time.new.to_f)

   bfr = Time.new

   begin

 DB.transaction do 

artists.insert( :name => name )

   est = Time.new - bfr

   debug "--> write #{est}sec #{Actor.current}"

 end

   rescue

 est = Time.new - bfr

 debug "--> write(#{$!}) #{est}sec #{Actor.current}"

 STDERR.puts $!.backtrace

   end

  end

end





manager = Celluloid::SupervisionGroup.run!



manager.pool(Writer, as: :writer, args: [], size: 2)

manager.pool(Reader, as: :reader, args: [], size: 2)



sleep




I, [2015-04-04T12:49:34.936240 #45666]  INFO -- : (0.000677s) PRAGMA 
foreign_keys = 1
I, [2015-04-04T12:49:34.936358 #45666]  INFO -- : (0.28s) PRAGMA 
case_sensitive_like = 1
I, [2015-04-04T12:49:34.936914 #45666]  INFO -- : (0.000485s) SELECT 
sqlite_version()
I, [2015-04-04T12:49:34.938964 #45666]  INFO -- : (0.001836s) DELETE FROM 
`artists` WHERE (1 = 1)
I, [2015-04-04T12:49:35.944744 #45666]  INFO -- : (0.000109s) BEGIN
I, [2015-04-04T12:49:35.947201 #45666]  INFO -- : (0.001993s) INSERT INTO 
`artists` (`name`) VALUES ('test1428119375.944484')
D, [2015-04-04T12:49:35.947593 #45666] DEBUG -- : --> write 0.002763sec 
#
I, [2015-04-04T12:49:35.948436 #45666]  INFO -- : (0.000281s) PRAGMA 
foreign_keys = 1
I, [2015-04-04T12:49:35.950077 #45666]  INFO -- : (0.001104s) COMMIT
I, [2015-04-04T12:49:35.950211 #45666]  INFO -- : (0.39s) PRAGMA 
case_sensitive_like = 1
I, [2015-04-04T12:49:35.950584 #45666]  INFO -- : (0.000125s) BEGIN
I, [2015-04-04T12:49:35.951233 #45666]  INFO -- : (0.000234s) PRAGMA 
foreign_keys = 1
I, [2015-04-04T12:49:35.951347 #45666]  INFO -- : (0.47s) PRAGMA 
case_sensitive_like = 1
I, [2015-04-04T12:49:35.951766 #45666]  INFO -- : (0.000309s) SELECT * FROM 
`artists` WHERE (`id` = 1) LIMIT 1
I, [2015-04-04T12:49:35.952320 #45666]  INFO -- : (0.000332s) INSERT INTO 
`artists` (`name`) VALUES ('test1428119375.947833')
D, [2015-04-04T12:49:35.952678 #45666] DEBUG -- : --> write 0.004531sec 
#
I, [2015-04-04T12:49:35.953675 #45666]  INFO -- : (0.000919s) COMMIT
I, [2015-04-04T12:49:35.953958 #45666]  INFO -- : (0.000180s) SELECT * FROM 
`artists` WHERE (`id` = 1) LIMIT 1
D, [2015-04-04T12:49:35.954264 #45666] DEBUG -- : --> read 0.005512sec 
#
D, [2015-04-04T12:49:35.954528 #45666] DEBUG -- : --> read 0.005523sec 
#
I, [2015-04-04T12:49:36.94779

Re: Conditional Validation With Message

2015-04-03 Thread Jeremy Evans
On Friday, April 3, 2015 at 2:23:28 PM UTC-7, Elanor Riley wrote:
>
> Greetings!
>
> I have the following model in my code, but I cannot get the conditional 
> validation on multiple columns to work with a custom message.
>
> class Form < Sequel::Model(:requests)
>  one_to_many :comments
>  one_to_one :tour_guide
>
>  def validate
>  super
>  validates_presence [:tour_guide, :accepted_date] if status == 2, :message 
> => "Tour Guide and Accepted Date must be set in order to approve a 
> request."
>  end
> end
>
> When I attempt to run my application with this validation in place, I 
> receive the following error:
>
> /var/www/webapps/tourrequest/classes.rb:14: syntax error, unexpected ',', 
> expecting keyword_end
> ...:accepted_date] if status == 2, :message => "Tour Guide must...
> ...   ^ (SyntaxError)
>
>
> I would like to use a custom message, but it looks like my syntax is wrong.
>

You were close:

validates_presence [:tour_guide, :accepted_date], :message => "Tour Guide 
and Accepted Date must be set in order to approve a request." if status == 2

Thanks,
Jeremy

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sequel-talk+unsubscr...@googlegroups.com.
To post to this group, send email to sequel-talk@googlegroups.com.
Visit this group at http://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.


Re: Allowing #limit to take virtual rows

2015-04-03 Thread Jeremy Evans
On Friday, April 3, 2015 at 1:21:23 PM UTC-7, Janko Marohnić wrote:
>
> SphinxQL (the SQL dialect of Sphinx), supports LIMIT clause, but only the 
> oldschool type, without OFFSET. So, instead of "LIMIT 10 OFFSET 20" you 
> have to write "LIMIT 20, 10". I needed to do pagination, but I couldn't use 
> the pagination extension because it includes the OFFSET (for all the normal 
> SQLs), so I wrote it like this:
>
> ds.limit(Sequel.lit("#{(page - 1) * per_page}, #{per_page}"))
>
> It would be cool if #limit would accept virtual rows, so I could write
>
> ds.limit{[(page - 1) * per_page, per_page]} # => LIMIT 20, 10
>
> Other than this very specific purpose of using SphinxQL, I think this 
> would be useful if someone wanted to use an SQL function for LIMIT values, 
> or any SQL expression (however rare it might be).
>

I don't think many SQL databases support expressions in the limit clause, 
though some support bound variables.

>From what you are describing, if your first example with Sequel.lit works, 
then the following should also work:

  ds.limit((page - 1) * per_page, per_page)

You probably just need to override select_limit_sql in that SphinQL module:

  def select_limit_sql(sql)
 if (o = @opts[:offset]) && (l = @opts[:limit])
   sql << " LIMIT "
   literal_append(sql, o)
   sql << ", "
   literal_append(sql, l)
 else
   super
 end
  end

At some point, you may want to consider writing a sphinql adapter, instead 
of having an extension to the mysql adapter.

To answer your original question, no, I don't think virtual rows make sense 
for Dataset#limit.

Thanks,
Jeremy

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sequel-talk+unsubscr...@googlegroups.com.
To post to this group, send email to sequel-talk@googlegroups.com.
Visit this group at http://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.


Conditional Validation With Message

2015-04-03 Thread Elanor Riley
Greetings!

I have the following model in my code, but I cannot get the conditional 
validation on multiple columns to work with a custom message.

class Form < Sequel::Model(:requests)
 one_to_many :comments
 one_to_one :tour_guide

 def validate
 super
 validates_presence [:tour_guide, :accepted_date] if status == 2, :message 
=> "Tour Guide and Accepted Date must be set in order to approve a request."
 end
end

When I attempt to run my application with this validation in place, I 
receive the following error:

/var/www/webapps/tourrequest/classes.rb:14: syntax error, unexpected ',', 
expecting keyword_end
...:accepted_date] if status == 2, :message => "Tour Guide must...
...   ^ (SyntaxError)


I would like to use a custom message, but it looks like my syntax is wrong.

I have tried the following to no avail:

validates_presence([:tour_guide, :accepted_date] if status == 2, :message => 
"Tour 
Guide and Accepted Date must be set in order to approve a request.")

validates_presence([:tour_guide, :accepted_date] if status == 2), :message 
=> "Tour Guide and Accepted Date must be set in order to approve a request."

validates_presence(:tour_guide, :accepted_date if status == 2), :message => 
"Tour 
Guide and Accepted Date must be set in order to approve a request."

To clarify BOTH these work, just not at the same time:

# Multi column validation with message
validates_presence [:tour_guide, :accepted_date], :message => "Tour Guide 
and Accepted Date must be set in order to approve a request."
# Multi column validation with conditional, no message
validates_presence [:tour_guide, :accepted_date] if status == 2

Thank you for any assistance you can provide!

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sequel-talk+unsubscr...@googlegroups.com.
To post to this group, send email to sequel-talk@googlegroups.com.
Visit this group at http://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.


Allowing #limit to take virtual rows

2015-04-03 Thread Janko Marohnić
SphinxQL (the SQL dialect of Sphinx), supports LIMIT clause, but only the 
oldschool type, without OFFSET. So, instead of "LIMIT 10 OFFSET 20" you 
have to write "LIMIT 20, 10". I needed to do pagination, but I couldn't use 
the pagination extension because it includes the OFFSET (for all the normal 
SQLs), so I wrote it like this:

ds.limit(Sequel.lit("#{(page - 1) * per_page}, #{per_page}"))

It would be cool if #limit would accept virtual rows, so I could write

ds.limit{[(page - 1) * per_page, per_page]} # => LIMIT 20, 10

Other than this very specific purpose of using SphinxQL, I think this would 
be useful if someone wanted to use an SQL function for LIMIT values, or any 
SQL expression (however rare it might be).

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sequel-talk+unsubscr...@googlegroups.com.
To post to this group, send email to sequel-talk@googlegroups.com.
Visit this group at http://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.


Re: Appending custom SQL clause

2015-04-03 Thread Janko Marohnić
Perfect! Thank you :)

Janko

On Fri, Apr 3, 2015 at 9:02 PM Jeremy Evans  wrote:

> On Friday, April 3, 2015 at 10:04:22 AM UTC-7, Janko Marohnić wrote:
>>
>> Hi Jeremy,
>>
>> I'm using Sequel in combination with Sphinx. Sphinx has it's own SphinQL,
>> which is a limited version of MySQL. However, there is one clause that is
>> SphinQL-specific, and doesn't exist in the SQL language: "OPTION". Is it
>> possible to somehow append it in Sequel? I want to generate this "SQL":
>>
>> SELECT * FROM movies WHERE match('some query') OPTION field_weights=(
>> title=4, year=4);
>>
>> Note that I can't put the OPTION inside of WHERE
>> (`DB[:movies].where("MATCH (?) OPTION ...")'), because it's a separate
>> clause (and Sequel would group it with WHERE with parantheses). I also
>> can't do `DB["SELECT * FROM movies ..."]`, because when I later apply a
>> #limit, MySQL throws a syntax error.
>>
>
> My recommendation here would be to add an extension that the datasets
> could use that would change the SQL so that the OPTION clause was
> supported.  Something like:
>
>   # sequel/extensions/sphinql.rb
>   module SphinQL
> Sequel::Dataset.def_sql_method(self, :select, %w'select distinct
> calc_found_rows columns from join where option group having compounds order
> limit lock')
> def option(sql)
>   clone(:option => sql)
> end
> def select_option_sql(sql)
>   if option = opts[:option]
> sql << " OPTION " << option
>   end
> end
> Sequel::Dataset.register_extension(:sphinql, self)
>   end
>
> Then you could do:
>
>   DB.extension :sphinql
>   DB[:movies].
> where{match('some query')}.
> option('field_weights=(title=4, year=4)')
>
> Thanks,
> Jeremy
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "sequel-talk" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/sequel-talk/kZIXXCYSAU4/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> sequel-talk+unsubscr...@googlegroups.com.
> To post to this group, send email to sequel-talk@googlegroups.com.
> Visit this group at http://groups.google.com/group/sequel-talk.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sequel-talk+unsubscr...@googlegroups.com.
To post to this group, send email to sequel-talk@googlegroups.com.
Visit this group at http://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.


Re: Appending custom SQL clause

2015-04-03 Thread Jeremy Evans
On Friday, April 3, 2015 at 10:04:22 AM UTC-7, Janko Marohnić wrote:
>
> Hi Jeremy,
>
> I'm using Sequel in combination with Sphinx. Sphinx has it's own SphinQL, 
> which is a limited version of MySQL. However, there is one clause that is 
> SphinQL-specific, and doesn't exist in the SQL language: "OPTION". Is it 
> possible to somehow append it in Sequel? I want to generate this "SQL":
>
> SELECT * FROM movies WHERE match('some query') OPTION field_weights=(title
> =4, year=4);
>
> Note that I can't put the OPTION inside of WHERE 
> (`DB[:movies].where("MATCH (?) OPTION ...")'), because it's a separate 
> clause (and Sequel would group it with WHERE with parantheses). I also 
> can't do `DB["SELECT * FROM movies ..."]`, because when I later apply a 
> #limit, MySQL throws a syntax error.
>

My recommendation here would be to add an extension that the datasets could 
use that would change the SQL so that the OPTION clause was supported. 
 Something like:

  # sequel/extensions/sphinql.rb
  module SphinQL
Sequel::Dataset.def_sql_method(self, :select, %w'select distinct 
calc_found_rows columns from join where option group having compounds order 
limit lock')
def option(sql)
  clone(:option => sql)
end
def select_option_sql(sql)
  if option = opts[:option]
sql << " OPTION " << option
  end
end
Sequel::Dataset.register_extension(:sphinql, self)
  end

Then you could do:

  DB.extension :sphinql
  DB[:movies].
where{match('some query')}.
option('field_weights=(title=4, year=4)')

Thanks,
Jeremy

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sequel-talk+unsubscr...@googlegroups.com.
To post to this group, send email to sequel-talk@googlegroups.com.
Visit this group at http://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.


Considering Removing Some Adapters

2015-04-03 Thread Jeremy Evans
I'm considering removing the following adapters from Sequel:

* db2: Old db2 adapter that uses db2/db2cli, which I think only works on 
ruby 1.8. Passes tests, but extremely slowly (20 minutes per run). No 
reports of use, and any users should be able to switch to the ibmdb adapter.

* dbi: Never tested by me.  Upstream project has been dead for about 5 
years. Rare reports of use, but most users could use another adapter.

* fdbsql: Project is dead (bought and killed by Apple), unlikely anyone 
will be using this in the future to develop new code.

* firebird: Only works with wishdev's fork of the official fb driver.  No 
development in about 6 years.  I don't think the test suite can complete 
(locks up).  The basic dataset tests run, but even about 20% of those fail. 
Rare reports of use.

* informix: Never tested by me.  Rare reports of use.  I think the ibmdb 
adapter supports informix, so users should be able to transition to that. 
 Upstream has no activity for about 3 years.

* openbase: Never tested by me.  No reports of use.  Looks useless for 
anything except retrieving data.  Upstream driver last updated around 8 
years ago.

If anyone is using any of these adapters and wants to see Sequel continue 
to ship them, please post here with your reasons before April 29th. 
 Otherwise, I plan to deprecate these adapters in 4.22.0 and remove them in 
a future version.

If anyone is using any of these adapters and wants to maintain them as an 
external adapter, please post here.  I plan on adding a section to the 
website with links to external adapters.

Thanks,
Jeremy

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sequel-talk+unsubscr...@googlegroups.com.
To post to this group, send email to sequel-talk@googlegroups.com.
Visit this group at http://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.


Appending custom SQL clause

2015-04-03 Thread Janko Marohnić
Hi Jeremy,

I'm using Sequel in combination with Sphinx. Sphinx has it's own SphinQL, 
which is a limited version of MySQL. However, there is one clause that is 
SphinQL-specific, and doesn't exist in the SQL language: "OPTION". Is it 
possible to somehow append it in Sequel? I want to generate this "SQL":

SELECT * FROM movies WHERE match('some query') OPTION field_weights=(title=4
, year=4);

Note that I can't put the OPTION inside of WHERE (`DB[:movies].where("MATCH 
(?) OPTION ...")'), because it's a separate clause (and Sequel would group 
it with WHERE with parantheses). I also can't do `DB["SELECT * FROM movies 
..."]`, because when I later apply a #limit, MySQL throws a syntax error.

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sequel-talk+unsubscr...@googlegroups.com.
To post to this group, send email to sequel-talk@googlegroups.com.
Visit this group at http://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.


Re: SQLite3::BusyException

2015-04-03 Thread Jeremy Evans
On Friday, April 3, 2015 at 2:49:46 AM UTC-7, Hiroyuki Sato wrote:
>
> Hello members.
>
> Question
>
>   I'm using Sequel with Celluloid(https://celluloid.io)
>   Celluloid is a multithread library for Ruby.
>   
>   And SQLite db is the file database. not on-memory db.
> 
>   I got SQLite3::BusyException, so I would like to avoid this exception.
>   
>   It is possible to access sqlite db from one thread at once?
>   Or should I access to sqlite from one thread?
>   
>   I changed those values , It seems good. 
> max_connections: 1
> pool_timeout: 10
>   
>   Should I change another parameters?
>   
>   Is there any best practice configuration for connect sqlite3 with multi 
> thread?
>

If you are only running a single process and you don't mind blocking 
queries in other threads (basically serializing access to the database), 
that should be fine.

For anything involving multithread or multiprocess access, it may be better 
to set a higher busy timeout on the underlying connection objects via the 
:timeout option (the default is 5000 milliseconds).

Thanks,
Jeremy

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sequel-talk+unsubscr...@googlegroups.com.
To post to this group, send email to sequel-talk@googlegroups.com.
Visit this group at http://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.


SQLite3::BusyException

2015-04-03 Thread Hiroyuki Sato
Hello members.

Question

  I'm using Sequel with Celluloid(https://celluloid.io)
  Celluloid is a multithread library for Ruby.
  
  And SQLite db is the file database. not on-memory db.

  I got SQLite3::BusyException, so I would like to avoid this exception.
  
  It is possible to access sqlite db from one thread at once?
  Or should I access to sqlite from one thread?
  
  I changed those values , It seems good. 
max_connections: 1
pool_timeout: 10
  
  Should I change another parameters?
  
  Is there any best practice configuration for connect sqlite3 with multi 
thread?
  
Environment

  OSX: 10.10.2
  Ruby: 2.2.1p85
  Sequel: 4.20.0
  SQLite: 3.8.5
  sqlite-ruby: 1.3.10
  celluloid: 0.16.0
  
--
Hiroyuki Sato.

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sequel-talk+unsubscr...@googlegroups.com.
To post to this group, send email to sequel-talk@googlegroups.com.
Visit this group at http://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.