Re: Lazy db connection

2023-04-10 Thread jaso...@gmail.com
Thanks Jeremy. I will definitely look into autoload, but I suspect the way we add extensions at startup to all models will make that not work. On Saturday, April 8, 2023 at 11:34:13 PM UTC-4 Jeremy Evans wrote: > On Sat, Apr 8, 2023 at 2:01 AM jaso...@gmail.com > wrote: > >&g

Lazy db connection

2023-04-07 Thread jaso...@gmail.com
I'll preface this question: We still have to work through upgrading deprecation warnings so we can upgrade to Sequel 5.0/Ruby 3 (we're on 4.49.0/2.7.3) The system I work on has numerous postgres databases it connects to (it's a bit of a monolith). We have servers that only use parts of the sys

Re: Migration to add a column with generated_always_as

2023-02-03 Thread jaso...@gmail.com
Always seems to happen, you find the answer after you've asked the question. Wasn't available until 5.24 according to github in one of the release notes. On Friday, February 3, 2023 at 11:16:56 AM UTC-5 jaso...@gmail.com wrote: > I'm adding a text column to a table t

Migration to add a column with generated_always_as

2023-02-03 Thread jaso...@gmail.com
I'm adding a text column to a table that will always be generated by a function created as immutable. When I create the migration, the `add_column` method call is not generating the proper `ALTER TABLE` with the `GENERATED ALWAYS AS`: add_column :standardized_accno, String, generated_al

Re: SQLite3 json serializer and naked

2021-12-12 Thread jaso...@gmail.com
Thank you!! On Sunday, December 12, 2021 at 5:56:03 PM UTC-5 Jeremy Evans wrote: > On Sun, Dec 12, 2021 at 2:16 PM jaso...@gmail.com > wrote: > >> I'm experimenting using SQLite with some json APIs. Since there's no >> out-of-the-box support for json columns,

SQLite3 json serializer and naked

2021-12-12 Thread jaso...@gmail.com
I'm experimenting using SQLite with some json APIs. Since there's no out-of-the-box support for json columns, I'm storing loosely-structured data as json in a Text column using the serialization plugin: plugin :serialization serialize_attributes :json. :transaction_data, :other_attributes This

Re: Eager load nested associations with reload or refresh

2021-05-24 Thread jaso...@gmail.com
-4 Jeremy Evans wrote: > On Mon, May 24, 2021 at 11:38 AM jaso...@gmail.com > wrote: > >> I am dealing a good deal of legacy code that is not very friendly to the >> database with a ton of nested n + 1 calls. I am slowly replacing them with >> code that takes ad

Eager load nested associations with reload or refresh

2021-05-24 Thread jaso...@gmail.com
I am dealing a good deal of legacy code that is not very friendly to the database with a ton of nested n + 1 calls. I am slowly replacing them with code that takes advantage of eager associations, nested four levels deep, which works phenomenally well for this particular use case as each parent

Re: save_changes when nothing actually changed

2020-10-19 Thread jaso...@gmail.com
onday, October 19, 2020 at 4:34:29 PM UTC-4 Jeremy Evans wrote: > On Mon, Oct 19, 2020 at 1:25 PM jaso...@gmail.com > wrote: > >> >> I have a situation where I want to set values in a few columns of a bunch >> of related rows, and write those changes out. I most cases, th

Re: save_changes when nothing actually changed

2020-10-19 Thread jaso...@gmail.com
Ok, great, I will see what I can come up with! Thank you! On Monday, October 19, 2020 at 4:34:29 PM UTC-4 Jeremy Evans wrote: > On Mon, Oct 19, 2020 at 1:25 PM jaso...@gmail.com > wrote: > >> >> I have a situation where I want to set values in a few columns of a bunch &g

save_changes when nothing actually changed

2020-10-19 Thread jaso...@gmail.com
I have a situation where I want to set values in a few columns of a bunch of related rows, and write those changes out. I most cases, the data will remain unchanged, but I don't want to add a ton of extra logic to prevent writes. As an extreme oversimplification, suppose I have an array of ro

Re: Not a Sequel error, but curious how you'd solve this

2020-09-24 Thread jaso...@gmail.com
wrote: > On Thu, Sep 24, 2020 at 8:31 AM jaso...@gmail.com > wrote: > >> >> We ran into some code today that did a a `first` without an `order`. I >> can think of no situation where you don't include an order if you include >> first (unless you are absolu

Not a Sequel error, but curious how you'd solve this

2020-09-24 Thread jaso...@gmail.com
We ran into some code today that did a a `first` without an `order`. I can think of no situation where you don't include an order if you include first (unless you are absolutely sure there's only one row, for example reloading a row with eager data). I want to find a way to raise an error if