On Friday, October 14, 2016 at 3:44:00 PM UTC-7, Ryan Duryea wrote:
>
> Hi Jeremy,
>
> Thanks for adding this feature to Sequel. Very nice!
>
> I'm still not sure how to have the mock support advanced features of SQL
> such as 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?
>
You shouldn't need to do anything, as long as the shared adapter is setup
correctly. Example with mock PostgreSQL adapter:
$ ruby bin/sequel mock://postgres
DB.extension :date_arithmetic
puts DB[:table].with(:table, DB[:a]).select{a(Sequel.date_add(:b,
:days=>1)).over(:partition=>:c, :order=>:d)}.sql
# WITH "table" AS (SELECT * FROM "a") SELECT a((CAST("b" AS timestamp) +
CAST('1 days ' AS interval))) OVER (PARTITION BY "c" ORDER BY "d") FROM
"table"
If this isn't working for you, it's probably because the shared adapter you
are using doesn't have support for the mock adapter, or the shared adapter
doesn't enable support for those features.
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.