On Friday, September 23, 2016 at 9:19:21 PM UTC-7, Jeremy Evans wrote: > > On Friday, September 23, 2016 at 2:41:15 PM UTC-7, Ryan Duryea wrote: >> >> Hi Jeremy, >> >> I'm interested in having Sequel generate the SQL for a query without >> requiring a connection to a database. >> >> I'm wondering if I can use Sequel.mock to accomplish this? >> >> In looking at your tests [here]( >> https://github.com/jeremyevans/sequel/blob/master/spec/core/mock_adapter_spec.rb#L420) >> >> it seems this might be possible for many of the more common adapters Sequel >> supports. I'm hoping to enable this kind of support for the Impala dialect >> of SQL as supported in the [sequel-impala]( >> https://github.com/outcomesinsights/sequel-impala), but from what I can >> tell, the SHARED_ADAPTERS hash will need an key/value pair like "impala" => >> "Impala" in order to allow access to the impala dialect. >> >> Is that correct? >> >> Also, I'm looking to to have the mock support advanced features of SQL >> like window functions, date arithmetic, and CTEs. It looks like >> Sequel.mock won't do this by default. How do I enable support for those >> features in Sequel.mock? >> >> Thanks, >> Ryan >> > > Ryan, > > The current implementation of the mock adapter unfortunately does not make > it easy to support external shared adapters. However, I think it can be > modified fairly easily to do so. I'll try to do that this week, and post a > brief description of how to use it here afterward. >
I've added a commit that does this: https://github.com/jeremyevans/sequel/commit/f06491f95a6f7d2bf97479336e18b42dbe5c8593 As the commit message states, you can now support the mock adapter in external adapters using the following API in the shared adapter (code in file sequel/adapters/shared/mydb.rb module Sequel::MyDB Sequel::Database.set_shared_adapter_scheme :mydb, :self def self.mock_adapter_setup(db) # ... end module DatabaseMethods # ... end module DatasetMethods # ... end end 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 https://groups.google.com/group/sequel-talk. For more options, visit https://groups.google.com/d/optout.