Re: Merb 0.9.3 And Sequel 1.5.1

2008-05-08 Thread David
Thanks for your detailed explanation Jeremy... for now I've gone back to 1.4.0 as it was working well for my apps which use the ODBC and ADO adapters. On May 9, 1:00 am, Jeremy Evans [EMAIL PROTECTED] wrote: On May 7, 10:05 pm, Davo [EMAIL PROTECTED] wrote: Hi, I originally posted this in

nested_attributes and Model consistency before saving

2014-08-26 Thread david
, but it seems that inconsistency is bad behaviour for base Sequel. What do you think about it? Thank you for your opinions. Greets. -- David -- You received this message because you are subscribed to the Google Groups sequel-talk group. To unsubscribe from this group and stop receiving emails

Conditional INSERT to PostgreSQL

2015-07-06 Thread david
a custom create? method with the above INSERT WHERE NOT EXISTS syntax on MyDoc model? Also might support for this this make sense as a Sequel extension? Thanks, David -- You received this message because you are subscribed to the Google Groups sequel-talk group. To unsubscribe from this group

Using insert_ignore/insert_conflict with Models

2015-12-30 Thread david
Back in July I had asked and received helpful suggestions about doing "Conditional INSERT to PostgreSQL" [1]. I'm now trying to take advantage of the PostgreSQL 9.5 "ON CONFLICT" feature as a solution. Starting with the simplest case, I previously had as a Model ClassMethod and peer to

Re: Using insert_ignore/insert_conflict with Models

2015-12-30 Thread david
On Wednesday, December 30, 2015 at 12:18:45 PM UTC-8, Jeremy Evans wrote: > > This will probably work for what you want: > > def create?( h ) >c = dataset.returning.insert_ignore.insert(new(h).values).first >c && call( c ) > end > Thanks very much for the pointer. With some more

Sequel 5 and Model mocking

2018-04-17 Thread david
it (I talk about _fetch use for returning data) I get a "deprecation" warning. We are in process for adopting Sequel 5 ASAP, so my question is: how can I mock Model data in Sequel for testing 5 versions? Thank you very much. -- David -- You received this message because you are subs

Re: Sequel 5 and Model mocking

2018-04-18 Thread david
about the mock adapter, please post them > here. > I can't use with_fetch with proc for defining return data from query info. -- David -- You received this message because you are subscribed to the Google Groups "sequel-talk" group. To unsubscribe from this group and stop

Re: Sequel 5 and Model mocking

2018-04-17 Thread david
El martes, 17 de abril de 2018, 19:28:01 (UTC+2), Jeremy Evans escribió: > > For fully mocked tests, Sequel ships with a mock adapter you can use. Great! Where can I find good example documentation? -- David -- You received this message because you are subscribed to the Google

Re: Custom IdentityMap plugin

2018-03-26 Thread david
t; I am interested in your opinion about identity map. Why do yo think it causes more problems that it solves? Thank you for your hints :) -- David -- You received this message because you are subscribed to the Google Groups "sequel-talk" group. To unsubscribe from this group an

Re: Custom IdentityMap plugin

2018-04-02 Thread david
ess environment, so there is no problem of complex cross logic between users. In that context, Identity Map is very useful :) -- David -- You received this message because you are subscribed to the Google Groups "sequel-talk" group. To unsubscribe from this group and stop receiving email

Custom IdentityMap plugin

2018-03-19 Thread david
are best code points for resolving my needs? Thank you very much. -- David -- 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...@google

Problems with reciprocal assignation (and others...)

2018-03-05 Thread david
f3] Do you see these requirements logical? If we have reciprocal and object assignation, I think these are two annoying Sequel effects that go against "least surprise" principle. Greets. -- David -- You received this message because you are subscribed to the Google Groups "sequel-ta

Re: Problems with reciprocal assignation (and others...)

2018-03-05 Thread david
El lunes, 5 de marzo de 2018, 20:55:40 (UTC+1), Jeremy Evans escribió: > > On Monday, March 5, 2018 at 9:00:38 AM UTC-8, David wrote: >> >> Hi everybody. >> >> Look at this code: >> >> class Foo < Sequel::Model >> one_to_many :bars >>

Re: help with aggregation group by

2008-01-03 Thread David Lee
You guys might already be aware of this, but SQLDSL by Jay Fields already supports this type of direct ruby-to-sql. http://sqldsl.rubyforge.org/ It could be helpful to collaborate SQLDSL. --~--~-~--~~~---~--~~ You received this message because you are subscribed

Re: Can queries return arrays of arrays?

2008-01-06 Thread David Lee
Maybe the code used for arrayfields (which has been deprecated?) can be used for this. Reference discussion: modeling tuples with hash vs array (http:// groups.google.com/group/sequel-talk/browse_thread/thread/ 61b9ad363bec5fbf) The arrayfields were slower than array of hashes because of the

Re: Can queries return arrays of arrays?

2008-01-06 Thread David Lee
The reason I suggested this to be included in the main code was so that it could be speedy if indeed the underlying database gives the ruby connection an array of arrays rather than an array of hashes. My suggestion was to have a way to _leave_ the data as an array of arrays (if that is what is

Re: Can queries return arrays of arrays?

2008-01-10 Thread David Lee
What is the best way to accomplish this with sequel as it is now? Does calling datasets.each cache the resulting hashes? If not, we could allow there to be datasets.each_array for the block argument to be an array instead of a hash. Modifying your example: def getrows(table = :mytable, cols

Re: Sequel::Migration foreign key constraint checks

2008-01-13 Thread David Lee
Perhaps a better (or just another) way to implement checks would be to add constraints as such: DB.create_table :users do ... varchar :full_name varchar :birthdate char :ssn, :size = 9 integer :age boolean :citizen ... constraint :legal_voter, :check = lambda

Re: Sequel::Migration foreign key constraint checks

2008-01-13 Thread David Lee
The automagic validation thing might be pretty cool to have in Sequel- Model, although I'm not sure how much of the more complex checks can be translated into ruby validations. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google

Re: Sequel::Model validations saving

2008-01-14 Thread David Lee
I wish validations were tightly integrated into the database. Validations are something that ActiveRecord was not good at. For example, validating uniqueness or presence of an associated object would actually not enforce validation (under rare race conditions). This is because it is impossible

Re: Sequel::Model validations saving

2008-01-15 Thread David Lee
Errors are, as you say, database-specific. However, we already do have database specific code, so it won't be causing any portability issues that were not there in the first place. That said, perhaps the simplest way of getting this started is to implement the database_validates_constraint

Re: Sequel::Model validations saving

2008-01-15 Thread David Lee
instead of database_validates_xxx we should say database_constrains_xxx. We could be more precise and call it depends_on_database_to_constrain_rows_based_on, but that would be silly. :) --David --~--~-~--~~~---~--~~ You received this message because you are subscribed

Re: Sequel::Model validations saving

2008-01-15 Thread David Lee
Once again, I'm not saying we should support constraints WITHIN the model. Let me state my assumptions: - validations exist to give users a nice error message to prevent models from being saved, because otherwise, the database will raise a nasty error - validations do not validate 100% -

Re: Sequel::Model#save returns false, maybe - Exception?

2008-02-03 Thread David Lee
Why don't we have Sequel::Model raise real errors? That way, we can have #save have a catch-all that catches all errors, regardless of whether they arise from Sequel::Model validations, or from the underlying database. Model validation errors can be inherited from Sequel::Model::ValidationError

Re: Full Text Searching

2008-02-09 Thread David Lee
Amazing... Were you working on full-text searching previously, or did you start after I mentioned it? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sequel-talk group. To post to this group, send email to

Errors with ODBC

2008-02-12 Thread David Lee
I'm using FreeTDS to connect to SQL Server using ODBC and am getting errors for different things: irb(main):001:0 Certificate.columns ODBC::Error: 37000 (170) [FreeTDS][SQL Server]Line 1: Incorrect syntax near '1'. irb(main):003:0 Certificate.first ODBC::Error: 37000 (170) [FreeTDS][SQL

Joining the results of a selection

2008-02-12 Thread David Lee
Hi, I wanted to do this: x = DB[:Certificates] x.join( x.select( :MAX[:modified], :serial ).group(:serial), {:modified = :modified, :serial = :serial} ) But the resulting sql turns into: SELECT * FROM Certificates INNER JOIN #Sequel::ODBC::Dataset: 0xb73ec97c ON

Re: batch inserting

2008-02-14 Thread David Lee
The Dataset#multi_insert method can also take a :commit_every option that specifies how often to commit the transaction. This is useful when youinserta large number of records and want to keep the transaction size manageable. For example: DB[:items].multi_insert([{:value = 1}, {:value =

Re: Sequel Todo

2008-04-10 Thread David Lee
DataMapper will probably be faster than AR or Sequel in the long run as they write their own database drivers in C (DataObjects). Doesn't AR do this as well? And will Sequel support C drivers in the future? I think the performance hit comes from the way models are constructed, but I'm not too

Re: 'AND' and 'OR' conditional statements using hashes

2008-04-10 Thread David Lee
The following is probably old-hat for some, but others might find it interesting if not useful: http://www.xaop.com/blog/2007/10/07/video-how-to-create-a-domain-spec... I like the DSL that they demonstrate in the link you provided. I think we might be able to get something very close to

Re: 'AND' and 'OR' conditional statements using hashes

2008-04-11 Thread David Lee
How would you negate a statement using this DSL? I would prefer to go the hash way if we can only implement the DSL half-way. For instance, p.author_id == nil would work, but p.author_id != nil would not work. You would not be able to negate blocks of conditions: !(p.date Date.today) would not

Re: Major security problem in string literal escape?

2008-04-13 Thread David Lee
Shawn, Thanks for the notice. Jeremy, I sent you a pull request with a fix. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sequel-talk group. To post to this group, send email to sequel-talk@googlegroups.com To

Association methods don't update reciprocal associations

2008-06-16 Thread David Lee
post = Post.create user = User.create post.user #= nil user.posts #= [] post.user = user post.user #= user user.posts #= [] (should be [post]) post.save user.posts #= still [] (should be [post]) --~--~-~--~~~---~--~~ You received this message because you are

Models should be cached based on primary key

2008-06-16 Thread David Lee
I thought this was already implemented, but I guess not: User[1].object_id == User[1].object_id #= false (should be true) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sequel-talk group. To post to this group,

How do you insert binary data using sequel + postgresql?

2008-06-16 Thread David Lee
PostgreSQL seems to only have one binary type: bytea. One big problem is that Ruby does not have a binary class. Another problem is that a PostgreSQL statement (insert/update) does not seem to support inputting binary data. That means all binary data must be escaped in the PostgreSQL style as

Re: Association methods don't update reciprocal associations

2008-06-16 Thread David Lee
class User Sequel::Model set_primary_key :user_id has_many :posts end class Post Sequel::Model belongs_to :user end I'm suspecting that changing the primary key has something to do with it. --~--~-~--~~~---~--~~ You received this message because you are

validates_presence_of should not error on boolean fields that have false value

2008-06-18 Thread David Lee
class Post Sequel::Model belongs_to :user validates_presence_of :email validates_presence_of :hidden end post = Post.new :user = User.create post.valid? #= false, that's good post.hidden = false post.valid? #= false, should be true Upon fixing this, I suggest that Model#create and

Re: validates_presence_of should not error on boolean fields that have false value

2008-06-18 Thread David Lee
1) We could use the db_schema to see if the column is a boolean and consider false as present just for booleans 2) We could add validates_inclusion_of: validates_inclusion_of :hidden, :in=[true, false] 3) We could add validates_boolean: validates_boolean :hidden 4) We could modify save to

Re: Request: Specify conditions per table in a join using hash

2008-07-06 Thread David Lee
If you want conditions on the join, you can already do something similar:   DB[:table1].join(:table2, [[:x,true], [:y,true], [:z, true], [true, :x], [true, :y], [true, :z]]) This is better than using the filter call, as it applies the conditions to the join instead of the entire query.

Re: Primary Foreign Key

2008-07-14 Thread David Lee
Here are some ideas that I proposed couple months ago to this google group: http://groups.google.com/group/sequel-talk/browse_thread/thread/be01496791052af0 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups

Re: Future Directions for Sequel

2008-07-15 Thread David Lee
Prepared Statements: This would allow you to prepare a statement once and call it multiple times with different inputs.  This is potentially much faster on certain databases, up to 60% on PostgreSQL, and from what I've heard possibly more on Oracle.  Here's how I think it should work:  

Re: update_only/set_restricted behavior

2009-03-09 Thread David Lee
You can't do either in 2.11, unless you apply the plugin/define the method in all of the subclasses. can you do: class MyModel Sequel::Model def set_only(*args) old = strict_param_setting self.strict_param_setting = false begin super ensure

Re: Simple Use Of Associations

2009-03-09 Thread David Lee
I vote for: Post.references User User.referenced_by Post # and if you want to support many_to_many Tag.references_many :posts, :through = 'posts_tags' Also, have you considered auto-generating these associations from the database schema? I think it would be pretty cool to have these

Bug with eager_graph and each

2009-03-18 Thread David Lee
When you do: Item.eager_graph(:user).all.first.type you get the type Item. However, when you do: Item.eager_graph(:user).each {|x| puts x.type} x will be a Hash. I expect each to pass Item objects instead of Hashes to the block. --~--~-~--~~~---~--~~ You

What's the best way to do a full text search with a Model?

2009-03-18 Thread David Lee
I know I can do this: Item.dataset.full_text_search [:name], 'Search Stuff' But this returns hashes instead of Item objects. I was wondering if we can have this: Item.full_text_search [:name], 'Search Stuff' --~--~-~--~~~---~--~~ You received this message

Re: Bug with eager_graph and each

2009-03-18 Thread David Lee
Shouldn't #each implicitly do what #all does (set up all associations) before returning? I really think all.each and each should behave exactly the same. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sequel-talk

Re: Bug with eager_graph and each

2009-03-19 Thread David Lee
You could make the same argument for Dataset#graph.  Unless you specify a row proc, Dataset#each always yields a hash with column symbol keys and column values, the only place where is pattern breaks is with graph, which changes Dataset#each to return a hash with table symbol keys, and hash

Re: Bug with eager_graph and each

2009-03-19 Thread David Lee
eager_graph.map returns an array of hashes with model object values. If all was an alias of map, eager_graph.all wouldn't return model objects with cached associations. That's exactly what I'm suggesting. Here's a break down, including a new name include (taken from ActiveRecord) instead of

Dynamic association eager loading

2009-04-01 Thread David Lee
dynamically (against some argument, in this case params[:id]). I feel like there would be something to the effect of: Post.eager_graph(:comments).eager_filter(:user_id = params [:id]).eager_limit(1) but I can't find it. Can you help me with this? --David

Lost for how to use Models and Associations

2009-06-04 Thread David Fisher
I'm really lost for how to properly use models. I understand how to use Sequel for stuff like the short example on the front page (http:// sequel.rubyforge.org/), creating a table and dataset, inserting, finding and updating items on the dataset. Pretty much everything in the Cheat Sheet makes

Re: Lost for how to use Models and Associations

2009-06-04 Thread David Fisher
Scott, Thanks for that! Shocked I didn't run across those in my googling before. A ton of good data. Bookmarked. dave On Thu, Jun 4, 2009 at 3:37 PM, Scott LaBounty slabou...@gmail.com wrote: David, Don't know if this will fully answer all your questions, but I've tried to document what I

Re: Finding by Dates

2009-07-02 Thread David Fisher
In my experience, Sqlite3 doesn't handle most strings well for date comparisons. It works sometimes, but not always. Postgres has treated me much better so far in this regard. dave On Thu, Jul 2, 2009 at 12:49 PM, Scott LaBountyslabou...@gmail.com wrote: Jeremy, Here's what I'm trying:

More accurate changed_columns

2009-07-23 Thread David Lee
I wanted to propose a way to generate a more accurate changed_columns. Currently, Model#[]= sets the changed_columns array whenever the new value is not equal to the old value. As explained in the documentation, this approach fails when a new value is unequal before typecast but equal after

Re: More accurate changed_columns

2009-07-23 Thread David Lee
(:name = 'david') x.name.gsub! 'david', 'dave' x.save #= no change x.name = 'dave' x.save #= no change # Problematic only in new implementation x.name = x.name.gsub!('david', 'dave') x.save #= no change, but would have changed in previous implementation

Re: More accurate changed_columns

2009-07-24 Thread David Lee
I just added #saved_values and #changes because they were easy to implement given the new way to detect changes. Those methods don't have to be added (#saved_values can just be private). --~--~-~--~~~---~--~~ You received this message because you are subscribed to

Re: newbie can't connect to local mysql db

2009-08-05 Thread David Jenkins
That did it, thanks! The working code for those interested: require 'rubygems' require 'sequel' gem('mysql') # = because I didn't remove the pure mysql driver #DB = Sequel.connect(:adapter='mysql', :host='localhost', :database='finqueries', :user='root', :password='') DB =

Re: How to connect to MS SQL using Sequel.odbc

2009-08-07 Thread David Jenkins
Well, I got it (Sequel + odbc) working, altho I'm not exactly sure how. I went down a number of roads, including trying to get ruby-odbc ( http://www.ch-werner.de/rubyodbc/) installed -- which never succeeded. But in order for that to work, I had to install unixODBC 2.x or libiodbc 3.52 on UN*X,

Re: it support stored procedures in SQL Server? How to get the return value?

2009-08-13 Thread David Jenkins
Nevermind, I just used raw SQL. On Thu, Aug 13, 2009 at 10:21 PM, dj djenkins...@gmail.com wrote: I've got a stored procedure on a DB I'm accessing through ODBC (for Sequel); when I use it natively, I use this syntax: Select * from getcrossdata('MSFT', '1986-03-13', '2009-08-12') (the

Re: it support stored procedures in SQL Server? How to get the return value?

2009-08-13 Thread David Jenkins
Thanks, Jeremy. I tried dataset = DB['SELECT * from getcrossdata(\'MSFT\', \'1986-03-13\', \'2009-08-12\')'] where the raw SQL natively (i.e., in an isql session) takes about 1.5 seconds to return the dataset, and using Sequel I killed it after about 2 minutes. I then tried your syntax, and it

can't do if test on smallint database value

2009-09-24 Thread David Jenkins
I'm using mysql; I create a dataset via this command: dataset = DB['call GetInstRecs(\'MSFT\', \'S\')'] where, obviously, GetInstRecs is a stored procedure in mysql which returns a field named weekendday, among others. It's of type smallint. When I try this: dataset.map do |r| if

Bug for Sequel::Model limit/offset using jdbc mssql

2009-09-25 Thread David Lee
Hi, Sequel::Model's #limit/offset don't work using jdbc mssql because the row_proc to instantiate Model objects is being called before mssql's #each override gets to remove the row_number value. I would not suggest taking the quick fix approach to check if the yielded object (in mssql's #each's

Re: can't do if test on smallint database value

2009-09-25 Thread David Jenkins
running has actual non-comment code on those lines) -- the file in question being mysql.rb. On Fri, Sep 25, 2009 at 3:10 PM, John W Higgins wish...@gmail.com wrote: On Fri, Sep 25, 2009 at 11:49 AM, David Jenkins djenkins...@gmail.comwrote: tried p r[:weekendday].class, all Fixnum :( Try

Re: can't do if test on smallint database value

2009-09-25 Thread David Jenkins
FWIW, Figured out the NetBeans bug: it's actually hitting my breakpoints in my little test file (at lines 12, 19, and 20, in the current version), but for some reason it keeps showing the mysql.rb file, which contains comments at those lines. On Fri, Sep 25, 2009 at 3:19 PM, David Jenkins

Re: can't do if test on smallint database value

2009-09-25 Thread David Jenkins
:\x0Ehighprice0:\rlowprice0:\x0Fcloseprice0:\vvolume0:\x11openinterest0)[:weekendday] == 1 = true On Fri, Sep 25, 2009 at 12:46 PM, David Jenkins djenkins...@gmail.com wrote: Perhaps you can post the results of p(Marshal.dump(r)) for both cases: with the select, and with the stored procedure

(Internationalization) Having Sequel work with Rails' I18n

2009-10-06 Thread David Lee
I was wondering if anybody has used Sequel with Rails' I18n module. It would be great if Sequel Models could support all the localizations that ActiveRecord supports--localization of Model names, columns/ attributes, and validations. If Sequel does not work with Rails' I18n out of the box, what

Bug? #after_save not getting called on #save if no changes to values

2009-10-18 Thread David Lee
Right now, I have some logic that runs inside the after_save hook, but those aren't getting called when I call #save() if there have been no changes to values. I'm not sure if the correct behavior is to always be called after #save() or only be called after a real UPDATE/INSERT. I'm thinking it

Re: Bug? #after_save not getting called on #save if no changes to values

2009-10-19 Thread David Lee
Actually, I was calling #update. Doing a #set and then a #save successfully calls the after_save hook. I'm not sure if #save_changes (), and more specifically, #update(), should be skipping the #after_save hooks when there are no changed columns, although, as I expressed in the original post, I'm

Re: Bug? #after_save not getting called on #save if no changes to values

2009-10-19 Thread David Lee
1) Skips saving completely if the record has not been modified. 2) Saves only the changed columns if the record has been modified. I agree with this behavior. What I'm calling into question is if skipping saving should also skip all hooks. I think a more compelling case is the #after_update

Identity map bug

2009-12-02 Thread David Lee
Identity map does not unmap destroyed objects. Sequel should unmap the destroyed objects like this: x = SomeModel[1] x.nil? #= false x.destroy y = SomeModel[1] y.nil? #= true Instead, it current does this: x = SomeModel[1] x.nil? #= false x.destroy y = SomeModel[1] y.nil? #=

Re: request for optimization help

2010-01-14 Thread David Fisher
I didn't get a chance to look at your code much there, but it seems like you should be able to do this much quicker. 22GB isn't all that big of a database to begin with (something you could hold in memory likely), so I'm wondering if there's some server-level optimization that you need to do.

Re: Rebuilding From Scratch

2010-05-19 Thread David Fisher
I've been using Homebrew (http://github.com/mxcl/homebrew) to do most installing tasks these days- just as a helpful hint (if you're on a Mac) -David On Wed, May 19, 2010 at 9:10 AM, Scott LaBounty slabou...@gmail.com wrote: I just got a new machine after my old one died and I'm rebuilding

Block for find_or_create

2010-06-04 Thread David Kelso
of that, this is my first patch to sequel. Is there a guide to testing / doc practices somewhere? david -- You received this message because you are subscribed to the Google Groups sequel-talk group. To post to this group, send email to sequel-t...@googlegroups.com. To unsubscribe from this group, send email

Re: [Offtopic] rvm

2010-10-05 Thread David Fisher
RVM + Homebrew changed my life and re-grew my hair! No seriously, the combination is awesome. On Tue, Oct 5, 2010 at 10:45 PM, Michael Lang mwl...@cybrains.net wrote: Yeah, I griped about that one in one of the IRC channels...turns out there's a rubygems_snapshot gem that will package up the

Re: rvm

2010-10-06 Thread David Fisher
wrote: So Homebrew looks to be something for Macs only? Scott On Wed, Oct 6, 2010 at 7:00 AM, GregD gditr...@fuse.net wrote: On Oct 5, 11:32 pm, David Fisher tib...@gmail.com wrote: RVM + Homebrew changed my life and re-grew my hair! No seriously, the combination is awesome. +1

Version 3.20.0 seems to have broken first method on sql server connections.

2011-02-04 Thread David Brown
the issue. Thanks! -David -- You received this message because you are subscribed to the Google Groups sequel-talk group. To post to this group, send email to sequel-talk@googlegroups.com. To unsubscribe from this group, send email to sequel-talk+unsubscr...@googlegroups.com. For more options, visit

Programmatically creating filter expressions

2012-10-01 Thread David Lee
)} Is there a cleaner way to do this? Maybe someone already wrote a plugin? --David -- You received this message because you are subscribed to the Google Groups sequel-talk group. To view this discussion on the web visit https://groups.google.com/d/msg/sequel-talk/-/Zzhpok2wUiUJ. To post to this group

Re: Programmatically creating filter expressions

2012-10-03 Thread David Lee
Thanks, I guess I can do this: db[:people].where(Sequel::SQL::BooleanExpression.new(operator, column, value)) How would it work for unary operators, like NOT NULL? Also, is explicit usage of Sequel::SQL::BooleanExpression a supported public API (same guarantees of backwards compatibility)?

Using pg_row for dynamically generated composite types

2012-10-07 Thread David Lee
Hi, I wanted to use the pg_row extension for composite types that can be created/altered/dropped during runtime. How can I get pg_row to react properly to changing composite types? Also, I'm getting NoMethodError when calling register_row_type: 1.9.3p194 :003 Sequel.extension :pg_row =

Re: Using pg_row for dynamically generated composite types

2012-10-07 Thread David Lee
So apparently the documentation for how to use PGRow is wrong. I got the NoMethodError resolved by extending the Database object instead of Sequel: Sequel::Model.db.extension :pg_row Also, it seems like calling register_row_type on the same type will overwrite the previously registered row

Re: Using pg_row for dynamically generated composite types

2012-10-09 Thread David Lee
Thanks Jeremy. I don't know where I got the example for Sequel.extension... maybe I read the docs for pg_row_ops and got confused. It seems like your suggestion for manual parsing is the best way about this. -- You received this message because you are subscribed to the Google Groups

Shared database connection

2012-10-20 Thread David Ott
I am using Sequel on an application that is composed of about half a dozen sinatra services. These services use Sequel::Model.db to connect to postgres via some shared logic that is installed as a gem 'sequel_connection'. That connection logic is pretty simple. Here it is. module Persistence

Re: Shared database connection

2012-10-20 Thread David Ott
in the sinatra file. Can i call disconnect at the end of that init file? On Saturday, October 20, 2012 12:52:20 PM UTC-4, Jeremy Evans wrote: On Saturday, October 20, 2012 8:28:06 AM UTC-7, David Ott wrote: I am experiencing trouble with the connections dropping and not being re-establised. The air

Inhibiting unrecognized control settings for non-standard postgres

2013-07-16 Thread David Kulp
I'm experimenting with AWS' RedShift. Its interface is postgres. Pretty slick. But their postgres variant doesn't respond to the SET commands that are issued during an initial Sequel connection. Specifically: SET standard_conforming_strings = ON; ERROR: unrecognized configuration parameter

Re: Inhibiting unrecognized control settings for non-standard postgres

2013-07-16 Thread David Kulp
Thanks! That seemed to do the trick. RedShift is based on Postgres 8.0.2, so I was warned that some things may not work... but so far so good. On Tuesday, July 16, 2013 12:53:29 PM UTC-4, Jeremy Evans wrote: On Tuesday, July 16, 2013 9:32:16 AM UTC-7, David Kulp wrote: I'm experimenting

Problem with pg_array and Sequel::Model

2013-09-03 Thread David Lutterkort
the relevant extensions on my DB: Sequel.extension :core_extensions, :inflector Sequel.extension :pg_array, :pg_array_ops require 'sequel/plugins/serialization' David -- You received this message because you are subscribed to the Google Groups sequel-talk group. To unsubscribe from this group and stop

Re: Problem with pg_array and Sequel::Model

2013-09-03 Thread David Lutterkort
= ('serial=1') WHERE (id = 1) Which is missing the coercion to array (probably connected to the fact that after the create, n.hw_info is an Array, not a PGArray) Any help is much appreciated. David On Tue, Sep 3, 2013 at 5:53 PM, Jeremy Evans jeremyeva...@gmail.com wrote: On Tuesday, September 3

Re: Problem with pg_array and Sequel::Model

2013-09-03 Thread David Lutterkort
That did the trick. Awesome, thanks. David On Tue, Sep 3, 2013 at 7:21 PM, Jeremy Evans jeremyeva...@gmail.com wrote: On Tuesday, September 3, 2013 6:31:41 PM UTC-7, David Lutterkort wrote: Hi Jeremy, thanks for the quick reply; unfortunately, that does not seem to make a difference

Using the DB's idea of time in a model

2013-09-09 Thread David Lutterkort
# This doesn't work, but I'd like to do something like this so that # ultimately the update query looks like # update nodes # set last_checkin = now() # where id = :some_id self.last_checkin = Sequel.function(:now) save_changes end Is something like that possible ? David

chained filters for joined tables, noob question

2013-10-07 Thread David Bradford
Given the following models: class Plan Sequel::Model one_to_many :user_plans end class User Sequel::Model one_to_many :plans, class: UserPlan end class UserPlan Sequel::Model many_to_one :user many_to_one :plan end I'd like to have chainable filters on UserPlan that filter on

Modifying an existing constraint_validations constraint

2013-10-10 Thread David Lutterkort
; end; end; end After migrating, the repos table has the correct constraint; unfortunately, the url_is_simple validation is missing from sequel_constraint_validations. Is there another way to achieve this ? David -- You received this message because you are subscribed to the Google Groups

Re: Modifying an existing constraint_validations constraint

2013-10-11 Thread David Lutterkort
Hi Jeremy, thanks for hte response; yes, that workaround is perfectly fine, and I can live with that. David On Thu, Oct 10, 2013 at 5:27 PM, Jeremy Evans jeremyeva...@gmail.comwrote: On Thursday, October 10, 2013 4:12:08 PM UTC-7, David Lutterkort wrote: Hi, in my DB schema I previously

Cassandra requiring primary key defined for a column during table generation

2013-11-08 Thread David Leung
I'm trying to write the cassandra cql-rb adapter for sequel, and I have a working branch here: https://github.com/dleung/sequel/tree/adapter/cassandra. I'm trying to run the database integration tests, specifically: @db.create_table!(:items){Integer :i} # = Cql::QueryError: No PRIMARY KEY

Re: Cassandra requiring primary key defined for a column during table generation

2013-11-12 Thread David Leung
Thanks, Jeremy! On Friday, November 8, 2013 5:18:48 PM UTC-8, Jeremy Evans wrote: On Friday, November 8, 2013 4:47:58 PM UTC-8, David Leung wrote: I'm trying to write the cassandra cql-rb adapter for sequel, and I have a working branch here: https://github.com/dleung/sequel/tree/adapter

Re: Digest for sequel-talk@googlegroups.com - 2 Messages in 2 Topics

2014-02-02 Thread David Leung
sequel-talk+unsubscr...@googlegroups.com On Sun, Feb 2, 2014 at 1:05 AM, sequel-talk@googlegroups.com wrote: Today's Topic Summary Group: http://groups.google.com/group/sequel-talk/topics - after_commit with transactional tests#143f1d820a09225f_group_thread_0[1 Update] - Sequel

Using "pg" adapter (not "postgres"), can't find "sequel/adapters/pg"

2016-03-14 Thread David Graff
I'm on Debian linux running ruby 2.3.0; I have these gems installed: $ gem list --local | egrep 'sequel|pg|postgres' pg (0.18.4) sequel (4.32.0, 4.30.0) sequel_pg (1.6.14) When I try to connect to a postgres server with "adapter => 'postgres'", the connection works, but if I say "adapter =>

Re: Object freeze and data reading

2017-01-16 Thread David Espada
pany end c = Company.first c.freeze ------>8 Greets. -- David -- 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 e

Re: Object freeze and data reading

2017-01-16 Thread David Espada
.../... > You could work around this issue by overriding Company#freeze to call > positions before calling super. > Thank you. I have a work around applied already. It is enough that it is solved by now ;) Greets. -- David -- You received this message because you are subscribed t

Re: "delay_add_association" plugin and one_to_one relationship

2016-09-01 Thread David Espada
2016-09-01 10:34 GMT+02:00 David Espada <da...@abstra.cc>: > > 2016-08-31 18:40 GMT+02:00 Jeremy Evans <jeremyeva...@gmail.com>: > >> plugin :instance_hooks >> >> def association=(v) >> after_save_hook{super} >> end >&g

Re: "delay_add_association" plugin and one_to_one relationship

2016-09-01 Thread David Espada
ably write your > only plugin, or just do: > > plugin :instance_hooks > > def association=(v) > after_save_hook{super} > end > =8) Is this code valid for all association types? If so, great! I'll try it. Thank you very much. -- David -- You received

Re: "delay_add_association" plugin and one_to_one relationship

2016-09-01 Thread David Espada
2016-09-01 10:51 GMT+02:00 David Espada <da...@abstra.cc>: > I have tested and it doesn't wotk :( > Ouch! Now I understand that your example is not generic code, but a redefinition of specific association code. Sorry :) -- David -- You received this message because you ar

  1   2   >