Thank you for your attention. I suspected this wouldn't be supported but 
your tip about cloning the whole dataset with all opts worked like a charm! 
I guess we will follow with this solution and later we can rewrite :)

Em sexta-feira, 16 de junho de 2023 às 15:17:51 UTC-3, Jeremy Evans 
escreveu:

> On Fri, Jun 16, 2023 at 10:48 AM Rui Santos <[email protected]> wrote:
>
>> Hi, we are upgrading from sequel 4 to sequel 5 and we now since datasets 
>> are frozen I wonder how we could set the dataset database at runtime.
>>
>> We have a lot of code that will build a dataset with chaining and then 
>> change the database to run the dataset (on a reporting database for 
>> example).
>>
>> I found that we can clone the dataset and set opts, but I couldn't figure 
>> it out if we can do that do the db. Something like:
>>
>> dataset.clone(db: different_db)
>>
>
> This is not supported in Sequel 5.  You should build the dataset using the 
> Sequel::Database you plan to run it on.
>
> However, if you don't mind something unsupported, you could try:
>
> ds = DB1[:table]
> ds = DB2.dataset.clone(ds.opts)
>
> 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 view this discussion on the web visit 
https://groups.google.com/d/msgid/sequel-talk/a4c3ddb6-c659-408f-a498-e00bb1fcd2den%40googlegroups.com.

Reply via email to