From 20f498fa0171e763ae54c022e42082cd552c807b Mon Sep 17 00:00:00 2001 From: karezche <64801825+karenc-bq@users.noreply.github.com> Date: Tue, 20 Oct 2026 17:45:36 -0700 Subject: [PATCH 1/3] docs - main (ruby): declare the gems Ruby 3.4 dropped, and make the first example runnable --- README.md | 4 +- content/failover.yaml | 137 +++++++++++++++++++++++++++---------- site/docs-ruby/overview.md | 79 ++++++++++++++++----- 3 files changed, 164 insertions(+), 56 deletions(-) diff --git a/README.md b/README.md index 3a80450..1fd33f6 100644 --- a/README.md +++ b/README.md @@ -25,8 +25,8 @@ Each wrapper's documentation is grouped into the same sections: | Section | What's in it | |--------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| **Overview** | What the wrapper is and how to install it. | -| **Set up by Scenario** | An interactive builder — answer a few questions about your application and get a working configuration. | +| **Overview** | What the wrapper is, how to install it, and one complete program that connects and runs a query. The page to read first. | +| **Set up by Scenario** | An interactive builder — answer a few questions about your application and get a working configuration. A browser page rather than prose, so it cannot be read as text. | | **Using Plugins** | One page per feature plugin (Failover, IAM Authentication, AWS Secrets Manager, Blue/Green, KMS Encryption, and so on), describing what the plugin does and every parameter it accepts. | | **Shared Configuration** | Cross-cutting settings — TLS/SSL, AWS credentials resolution, host selection strategies — that more than one plugin relies on. | | **Compatibility** | Which plugins work with which database engines, which endpoint types, and which other plugins. | diff --git a/content/failover.yaml b/content/failover.yaml index cf647ae..e054634 100644 --- a/content/failover.yaml +++ b/content/failover.yaml @@ -70,11 +70,22 @@ wrappers: # optional heading and an ordered list of blocks; a block is either prose # (`text`) or a fenced code sample (`code` + `lang`). # - # Active Record comes first because the adapters are the wrapper's primary - # integration: changing the adapter name is the whole change. The gem name - # matches its entry point file, so Bundler's default require loads it. + # Active Record leads because most Ruby users arrive through it: the adapters + # are the wrapper's primary integration and changing the adapter name is the + # whole change. The driver-direct path follows under an unnumbered "Or ..." + # heading, which is where an alternative goes in this style. + # + # The driver-direct block is a whole working program, not a fragment. A + # reader who copies it has a process that connects, queries and exits, with + # no gaps to fill from elsewhere on the site: the exact gem name, the exact + # require path, the constructor, the query call, and the teardown are all + # present. Fragments cost a reader (and an agent reading on their behalf) an + # edit-and-rerun loop per gap, which is the most expensive thing a + # getting-started page can do. The Active Record path cannot be shown that + # way because it needs a Rails application around it, so the two paths are + # ordered by who the reader is, not by what fits in one file. gettingStarted: - note: "Requires Ruby 3.3 or later. Tested with Active Record 7.2, 8.0, and 8.1, `pg` 1.6.3 or later, and `mysql2` 0.5.7 or later." + note: "Requires Ruby 3.3 or later. The gem is `aws_advanced_ruby_driver_wrapper` on RubyGems. Tested with Active Record 7.2, 8.0, and 8.1, `pg` 1.6.3 or later, and `mysql2` 0.5.7 or later." steps: - title: "1. Add the gem" blocks: @@ -87,17 +98,43 @@ wrappers: code: | bundle install - text: >- - Bundler requires the gem for you (in a plain Ruby script, add - `require 'aws_advanced_ruby_driver_wrapper'`). That single require - registers the Active Record adapters and makes the connection classes, - error classes, and other public API available for direct use. + Without Bundler, `gem install aws_advanced_ruby_driver_wrapper pg` + does the same thing. + # The house pattern for "this needs another gem" is a warning with + # its own snippet, as on the IAM and Secrets Manager pages, rather + # than commented lines inside the main Gemfile. + - text: | + :::warning + On Ruby 3.4 or later, also add these to your Gemfile: + + ```ruby + gem 'base64' + gem 'bigdecimal' + gem 'fiddle' + gem 'logger' + ``` + + Ruby 3.4 removed all four from the default gems. The wrapper requires + them when it loads but does not declare them, so a bundle without them + raises `LoadError` on the first require. Outside a bundle they are + usually already installed. + ::: - title: "2. Point Active Record at your cluster" blocks: - text: >- The wrapper registers two adapters, `aws_postgresql` and `aws_mysql2`, - which are drop-in replacements for `postgresql` and `mysql2`. Change the - adapter name and point the host at your cluster endpoint: + which are drop-in replacements for `postgresql` and `mysql2`. + # Without this, Active Record raises AdapterNotFound and names only + # its own built-in adapters, which does not hint that a require is + # missing. Bundler covers the Rails case; a plain script does not. + - text: >- + Bundler requires the gem for you. In a plain Ruby script, add + `require 'aws_advanced_ruby_driver_wrapper'` first: that single require + is what registers both adapters, and without it Active Record reports + `aws_postgresql` as a nonexistent adapter. + - text: >- + Change the adapter name and point the host at your cluster endpoint: - lang: yaml code: | # config/database.yml @@ -108,13 +145,10 @@ wrappers: username: password: - text: >- - That is the whole change — no application code moves. When - `wrapper_plugins` is not set, the wrapper loads `failover` and - `initial_connection`, so connections made through this adapter already - recover when the cluster promotes a new writer. Enable more by adding - wrapper properties alongside the Active Record keys. Setting - `wrapper_plugins` replaces the default list rather than adding to it, so - list the defaults you want to keep: + That is the whole change — no application code moves, and + connections made through this adapter already recover when the + cluster promotes a new writer. Wrapper properties go alongside the + Active Record keys: - lang: yaml code: | production: @@ -123,6 +157,10 @@ wrappers: wrapper_plugins: failover,initial_connection,iam iam_region: us-east-1 failover_timeout_sec: 300.0 # seconds + - text: >- + `wrapper_plugins` is optional — leaving it out loads + `failover,initial_connection`. Setting it replaces the default list + rather than adding to it, so list the defaults you want to keep. - text: >- Active Record keeps its own connection pool and its reading and writing roles; the wrapper's plugins run underneath both. @@ -134,16 +172,27 @@ wrappers: (`aws_postgresql`/`aws_mysql2`), a custom type registered for one is shared with the other, because both resolve under the same underlying adapter key. ::: + - text: | + :::note Keeping the password out of your source + Read it from the environment with `ENV.fetch('PGPASSWORD')`, or have + AWS manage it: add `secrets_manager` to `wrapper_plugins` and drop the + `password:` key, as described on + [AWS Secrets Manager Plugin](using-plugins/aws-secrets-manager). For a + database user with no password at all, add `iam` instead; see + [IAM Authentication Plugin](using-plugins/iam-authentication). + ::: - title: "Or connect with the driver directly" blocks: - text: >- - If you use the `pg` or `mysql2` gem without Active Record, the wrapper - provides connection classes that stand in for `PG::Connection` and - `Mysql2::Client`: + Without Active Record, the wrapper provides connection classes that + stand in for `PG::Connection` and `Mysql2::Client`. This is a complete + program; save it as `main.rb` and run it: - lang: ruby code: | - # PostgreSQL (pg) + # main.rb + require 'aws_advanced_ruby_driver_wrapper/postgresql' + conn = AwsAdvancedRubyDriverWrapper::WrapperPgConnection.new( host: 'my-cluster.cluster-xyz.us-east-1.rds.amazonaws.com', dbname: 'mydb', @@ -152,27 +201,43 @@ wrappers: wrapper_plugins: 'failover', failover_timeout_sec: 300.0 ) - - lang: ruby + + begin + result = conn.exec('SELECT version()') + puts result.first['version'] + ensure + conn.close + end + - lang: bash code: | - # MySQL (mysql2) - conn = AwsAdvancedRubyDriverWrapper::WrapperMysql2Client.new( - host: 'my-cluster.cluster-xyz.us-east-1.rds.amazonaws.com', - database: 'mydb', - username: '', - password: '', - wrapper_plugins: 'failover', - failover_timeout_sec: 300.0 - ) + bundle exec ruby main.rb - text: >- - The calls your code already makes on the driver connection keep working, - and the plugins act on each one. - + `require 'aws_advanced_ruby_driver_wrapper/postgresql'` is the + PostgreSQL entry point; for MySQL use + `require 'aws_advanced_ruby_driver_wrapper/mysql'` and + `AwsAdvancedRubyDriverWrapper::WrapperMysql2Client`, which takes + `database:` and `username:` where the PostgreSQL class takes + `dbname:` and `user:`. Either class stands in for the driver's own + (`PG::Connection`, `Mysql2::Client`): the calls your code already + makes keep working, and the plugins act on each one. + - text: | + :::warning + `exec` returns its result and does not yield to a block, unlike + `PG::Connection#exec`. Use the return value as above. + `conn.exec(sql) { |result| ... }` runs the query but never calls the + block, so the result is silently discarded. + ::: - title: "Next" blocks: + - text: >- + Every wrapper property the example did not use is listed with its + type, default and unit on the plugin page that reads it, starting + with [Enhanced Failover Plugin](enhanced-failover). To check a + combination before shipping, see + [Plugin Compatibility](compatibility). - text: >- Not sure which plugins you need? [Set up by Scenario](setup) builds a - configuration from a few questions about your application. To check a - combination before shipping, see [Plugin Compatibility](compatibility). + configuration from a few questions about your application. parameters: - concept: failoverMode diff --git a/site/docs-ruby/overview.md b/site/docs-ruby/overview.md index 13c7535..ca953e3 100644 --- a/site/docs-ruby/overview.md +++ b/site/docs-ruby/overview.md @@ -21,7 +21,7 @@ will follow your choice where an equivalent page exists. ## Getting started -Requires Ruby 3.3 or later. Tested with Active Record 7.2, 8.0, and 8.1, `pg` 1.6.3 or later, and `mysql2` 0.5.7 or later. +Requires Ruby 3.3 or later. The gem is `aws_advanced_ruby_driver_wrapper` on RubyGems. Tested with Active Record 7.2, 8.0, and 8.1, `pg` 1.6.3 or later, and `mysql2` 0.5.7 or later. ### 1. Add the gem @@ -35,11 +35,32 @@ gem 'pg' # or: gem 'mysql2' bundle install ``` -Bundler requires the gem for you (in a plain Ruby script, add `require 'aws_advanced_ruby_driver_wrapper'`). That single require registers the Active Record adapters and makes the connection classes, error classes, and other public API available for direct use. +Without Bundler, `gem install aws_advanced_ruby_driver_wrapper pg` does the same thing. + +:::warning +On Ruby 3.4 or later, also add these to your Gemfile: + +```ruby +gem 'base64' +gem 'bigdecimal' +gem 'fiddle' +gem 'logger' +``` + +Ruby 3.4 removed all four from the default gems. The wrapper requires +them when it loads but does not declare them, so a bundle without them +raises `LoadError` on the first require. Outside a bundle they are +usually already installed. +::: + ### 2. Point Active Record at your cluster -The wrapper registers two adapters, `aws_postgresql` and `aws_mysql2`, which are drop-in replacements for `postgresql` and `mysql2`. Change the adapter name and point the host at your cluster endpoint: +The wrapper registers two adapters, `aws_postgresql` and `aws_mysql2`, which are drop-in replacements for `postgresql` and `mysql2`. + +Bundler requires the gem for you. In a plain Ruby script, add `require 'aws_advanced_ruby_driver_wrapper'` first: that single require is what registers both adapters, and without it Active Record reports `aws_postgresql` as a nonexistent adapter. + +Change the adapter name and point the host at your cluster endpoint: ```yaml # config/database.yml @@ -51,7 +72,7 @@ production: password: ``` -That is the whole change — no application code moves. When `wrapper_plugins` is not set, the wrapper loads `failover` and `initial_connection`, so connections made through this adapter already recover when the cluster promotes a new writer. Enable more by adding wrapper properties alongside the Active Record keys. Setting `wrapper_plugins` replaces the default list rather than adding to it, so list the defaults you want to keep: +That is the whole change — no application code moves, and connections made through this adapter already recover when the cluster promotes a new writer. Wrapper properties go alongside the Active Record keys: ```yaml production: @@ -62,6 +83,8 @@ production: failover_timeout_sec: 300.0 # seconds ``` +`wrapper_plugins` is optional — leaving it out loads `failover,initial_connection`. Setting it replaces the default list rather than adding to it, so list the defaults you want to keep. + Active Record keeps its own connection pool and its reading and writing roles; the wrapper's plugins run underneath both. :::note Mixing wrapped and standard adapters in one application @@ -73,12 +96,24 @@ with the other, because both resolve under the same underlying adapter key. ::: +:::note Keeping the password out of your source +Read it from the environment with `ENV.fetch('PGPASSWORD')`, or have +AWS manage it: add `secrets_manager` to `wrapper_plugins` and drop the +`password:` key, as described on +[AWS Secrets Manager Plugin](using-plugins/aws-secrets-manager). For a +database user with no password at all, add `iam` instead; see +[IAM Authentication Plugin](using-plugins/iam-authentication). +::: + + ### Or connect with the driver directly -If you use the `pg` or `mysql2` gem without Active Record, the wrapper provides connection classes that stand in for `PG::Connection` and `Mysql2::Client`: +Without Active Record, the wrapper provides connection classes that stand in for `PG::Connection` and `Mysql2::Client`. This is a complete program; save it as `main.rb` and run it: ```ruby -# PostgreSQL (pg) +# main.rb +require 'aws_advanced_ruby_driver_wrapper/postgresql' + conn = AwsAdvancedRubyDriverWrapper::WrapperPgConnection.new( host: 'my-cluster.cluster-xyz.us-east-1.rds.amazonaws.com', dbname: 'mydb', @@ -87,23 +122,31 @@ conn = AwsAdvancedRubyDriverWrapper::WrapperPgConnection.new( wrapper_plugins: 'failover', failover_timeout_sec: 300.0 ) + +begin + result = conn.exec('SELECT version()') + puts result.first['version'] +ensure + conn.close +end ``` -```ruby -# MySQL (mysql2) -conn = AwsAdvancedRubyDriverWrapper::WrapperMysql2Client.new( - host: 'my-cluster.cluster-xyz.us-east-1.rds.amazonaws.com', - database: 'mydb', - username: '', - password: '', - wrapper_plugins: 'failover', - failover_timeout_sec: 300.0 -) +```bash +bundle exec ruby main.rb ``` -The calls your code already makes on the driver connection keep working, and the plugins act on each one. +`require 'aws_advanced_ruby_driver_wrapper/postgresql'` is the PostgreSQL entry point; for MySQL use `require 'aws_advanced_ruby_driver_wrapper/mysql'` and `AwsAdvancedRubyDriverWrapper::WrapperMysql2Client`, which takes `database:` and `username:` where the PostgreSQL class takes `dbname:` and `user:`. Either class stands in for the driver's own (`PG::Connection`, `Mysql2::Client`): the calls your code already makes keep working, and the plugins act on each one. + +:::warning +`exec` returns its result and does not yield to a block, unlike +`PG::Connection#exec`. Use the return value as above. +`conn.exec(sql) { |result| ... }` runs the query but never calls the +block, so the result is silently discarded. +::: + ### Next -Not sure which plugins you need? [Set up by Scenario](setup) builds a configuration from a few questions about your application. To check a combination before shipping, see [Plugin Compatibility](compatibility). +Every wrapper property the example did not use is listed with its type, default and unit on the plugin page that reads it, starting with [Enhanced Failover Plugin](enhanced-failover). To check a combination before shipping, see [Plugin Compatibility](compatibility). +Not sure which plugins you need? [Set up by Scenario](setup) builds a configuration from a few questions about your application. From 9f5953a2e7d24a137bb68fd1a099bbee37b82850 Mon Sep 17 00:00:00 2001 From: karezche <64801825+karenc-bq@users.noreply.github.com> Date: Thu, 22 Oct 2026 14:03:29 -0700 Subject: [PATCH 2/3] chore: address comments and add a complete active record sample code --- README.md | 2 +- content/failover.yaml | 74 +++++++++++++++++++++++--------------- site/docs-ruby/overview.md | 51 ++++++++++++++++---------- 3 files changed, 78 insertions(+), 49 deletions(-) diff --git a/README.md b/README.md index 1fd33f6..1c9226b 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ Each wrapper's documentation is grouped into the same sections: | Section | What's in it | |--------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | **Overview** | What the wrapper is, how to install it, and one complete program that connects and runs a query. The page to read first. | -| **Set up by Scenario** | An interactive builder — answer a few questions about your application and get a working configuration. A browser page rather than prose, so it cannot be read as text. | +| **Set up by Scenario** | An interactive builder — answer a few questions about your application and get a working configuration. | | **Using Plugins** | One page per feature plugin (Failover, IAM Authentication, AWS Secrets Manager, Blue/Green, KMS Encryption, and so on), describing what the plugin does and every parameter it accepts. | | **Shared Configuration** | Cross-cutting settings — TLS/SSL, AWS credentials resolution, host selection strategies — that more than one plugin relies on. | | **Compatibility** | Which plugins work with which database engines, which endpoint types, and which other plugins. | diff --git a/content/failover.yaml b/content/failover.yaml index e054634..9aa1997 100644 --- a/content/failover.yaml +++ b/content/failover.yaml @@ -105,19 +105,16 @@ wrappers: # than commented lines inside the main Gemfile. - text: | :::warning - On Ruby 3.4 or later, also add these to your Gemfile: + If you are using Ruby 3.4 or later, and are not using Active Record, also add these to your Gemfile: ```ruby gem 'base64' gem 'bigdecimal' - gem 'fiddle' gem 'logger' ``` - Ruby 3.4 removed all four from the default gems. The wrapper requires - them when it loads but does not declare them, so a bundle without them - raises `LoadError` on the first require. Outside a bundle they are - usually already installed. + Ruby 3.4 removed these from the default gems, so a bundle without them + raises `LoadError` on the first require. ::: - title: "2. Point Active Record at your cluster" @@ -134,7 +131,32 @@ wrappers: is what registers both adapters, and without it Active Record reports `aws_postgresql` as a nonexistent adapter. - text: >- - Change the adapter name and point the host at your cluster endpoint: + If you are starting without a Rails application, this is a complete + program. Save it as `main.rb` and run it: + - lang: ruby + code: | + # main.rb + require 'active_record' + require 'aws_advanced_ruby_driver_wrapper' + + ActiveRecord::Base.establish_connection( + adapter: 'aws_postgresql', + host: 'my-cluster.cluster-xyz.us-east-1.rds.amazonaws.com', + database: 'mydb', + username: '', + password: '', + wrapper_plugins: 'failover' + ) + + puts ActiveRecord::Base.connection.select_value('SELECT version()') + - lang: bash + code: | + bundle exec ruby main.rb + - text: >- + In a Rails application the same keys go in `config/database.yml` + instead, and Bundler has already done the require. The adapter name + is the only key that changes; leave the host as whichever endpoint + you already connect to: - lang: yaml code: | # config/database.yml @@ -148,7 +170,7 @@ wrappers: That is the whole change — no application code moves, and connections made through this adapter already recover when the cluster promotes a new writer. Wrapper properties go alongside the - Active Record keys: + Active Record keys, under the same connection: - lang: yaml code: | production: @@ -178,7 +200,7 @@ wrappers: AWS manage it: add `secrets_manager` to `wrapper_plugins` and drop the `password:` key, as described on [AWS Secrets Manager Plugin](using-plugins/aws-secrets-manager). For a - database user with no password at all, add `iam` instead; see + database user with no password at all, consider using `iam` instead; see [IAM Authentication Plugin](using-plugins/iam-authentication). ::: @@ -212,29 +234,23 @@ wrappers: code: | bundle exec ruby main.rb - text: >- - `require 'aws_advanced_ruby_driver_wrapper/postgresql'` is the - PostgreSQL entry point; for MySQL use - `require 'aws_advanced_ruby_driver_wrapper/mysql'` and - `AwsAdvancedRubyDriverWrapper::WrapperMysql2Client`, which takes - `database:` and `username:` where the PostgreSQL class takes - `dbname:` and `user:`. Either class stands in for the driver's own - (`PG::Connection`, `Mysql2::Client`): the calls your code already - makes keep working, and the plugins act on each one. - - text: | - :::warning - `exec` returns its result and does not yield to a block, unlike - `PG::Connection#exec`. Use the return value as above. - `conn.exec(sql) { |result| ... }` runs the query but never calls the - block, so the result is silently discarded. - ::: + For PostgreSQL, `require 'aws_advanced_ruby_driver_wrapper/postgresql'` + and use `AwsAdvancedRubyDriverWrapper::WrapperPgConnection`, which + stands in for `PG::Connection` and takes `dbname:` and `user:`. + For MySQL, `require 'aws_advanced_ruby_driver_wrapper/mysql'` and use + `AwsAdvancedRubyDriverWrapper::WrapperMysql2Client`, which stands in + for `Mysql2::Client` and takes `database:` and `username:`. Either + way the calls your code already makes keep working, and the plugins + act on each one. - title: "Next" blocks: - text: >- - Every wrapper property the example did not use is listed with its - type, default and unit on the plugin page that reads it, starting - with [Enhanced Failover Plugin](enhanced-failover). To check a - combination before shipping, see - [Plugin Compatibility](compatibility). + The wrapper supports other plugins and wrapper properties. For + further information see the plugin pages, starting with + [Enhanced Failover Plugin](enhanced-failover). Every wrapper property + the examples did not use is listed with its type, default and unit on + the plugin page that reads it. To check a combination before shipping, + see [Plugin Compatibility](compatibility). - text: >- Not sure which plugins you need? [Set up by Scenario](setup) builds a configuration from a few questions about your application. diff --git a/site/docs-ruby/overview.md b/site/docs-ruby/overview.md index ca953e3..07b6ab1 100644 --- a/site/docs-ruby/overview.md +++ b/site/docs-ruby/overview.md @@ -38,19 +38,16 @@ bundle install Without Bundler, `gem install aws_advanced_ruby_driver_wrapper pg` does the same thing. :::warning -On Ruby 3.4 or later, also add these to your Gemfile: +If you are using Ruby 3.4 or later, and are not using Active Record, also add these to your Gemfile: ```ruby gem 'base64' gem 'bigdecimal' -gem 'fiddle' gem 'logger' ``` -Ruby 3.4 removed all four from the default gems. The wrapper requires -them when it loads but does not declare them, so a bundle without them -raises `LoadError` on the first require. Outside a bundle they are -usually already installed. +Ruby 3.4 removed these from the default gems, so a bundle without them +raises `LoadError` on the first require. ::: @@ -60,7 +57,30 @@ The wrapper registers two adapters, `aws_postgresql` and `aws_mysql2`, which are Bundler requires the gem for you. In a plain Ruby script, add `require 'aws_advanced_ruby_driver_wrapper'` first: that single require is what registers both adapters, and without it Active Record reports `aws_postgresql` as a nonexistent adapter. -Change the adapter name and point the host at your cluster endpoint: +If you are starting without a Rails application, this is a complete program. Save it as `main.rb` and run it: + +```ruby +# main.rb +require 'active_record' +require 'aws_advanced_ruby_driver_wrapper' + +ActiveRecord::Base.establish_connection( + adapter: 'aws_postgresql', + host: 'my-cluster.cluster-xyz.us-east-1.rds.amazonaws.com', + database: 'mydb', + username: '', + password: '', + wrapper_plugins: 'failover' +) + +puts ActiveRecord::Base.connection.select_value('SELECT version()') +``` + +```bash +bundle exec ruby main.rb +``` + +In a Rails application the same keys go in `config/database.yml` instead, and Bundler has already done the require. The adapter name is the only key that changes; leave the host as whichever endpoint you already connect to: ```yaml # config/database.yml @@ -72,7 +92,7 @@ production: password: ``` -That is the whole change — no application code moves, and connections made through this adapter already recover when the cluster promotes a new writer. Wrapper properties go alongside the Active Record keys: +That is the whole change — no application code moves, and connections made through this adapter already recover when the cluster promotes a new writer. Wrapper properties go alongside the Active Record keys, under the same connection: ```yaml production: @@ -101,7 +121,7 @@ Read it from the environment with `ENV.fetch('PGPASSWORD')`, or have AWS manage it: add `secrets_manager` to `wrapper_plugins` and drop the `password:` key, as described on [AWS Secrets Manager Plugin](using-plugins/aws-secrets-manager). For a -database user with no password at all, add `iam` instead; see +database user with no password at all, consider using `iam` instead; see [IAM Authentication Plugin](using-plugins/iam-authentication). ::: @@ -135,18 +155,11 @@ end bundle exec ruby main.rb ``` -`require 'aws_advanced_ruby_driver_wrapper/postgresql'` is the PostgreSQL entry point; for MySQL use `require 'aws_advanced_ruby_driver_wrapper/mysql'` and `AwsAdvancedRubyDriverWrapper::WrapperMysql2Client`, which takes `database:` and `username:` where the PostgreSQL class takes `dbname:` and `user:`. Either class stands in for the driver's own (`PG::Connection`, `Mysql2::Client`): the calls your code already makes keep working, and the plugins act on each one. - -:::warning -`exec` returns its result and does not yield to a block, unlike -`PG::Connection#exec`. Use the return value as above. -`conn.exec(sql) { |result| ... }` runs the query but never calls the -block, so the result is silently discarded. -::: - +For PostgreSQL, `require 'aws_advanced_ruby_driver_wrapper/postgresql'` and use `AwsAdvancedRubyDriverWrapper::WrapperPgConnection`, which stands in for `PG::Connection` and takes `dbname:` and `user:`. For MySQL, `require 'aws_advanced_ruby_driver_wrapper/mysql'` and use `AwsAdvancedRubyDriverWrapper::WrapperMysql2Client`, which stands in for `Mysql2::Client` and takes `database:` and `username:`. Either way the calls your code already makes keep working, and the plugins act on each one. ### Next -Every wrapper property the example did not use is listed with its type, default and unit on the plugin page that reads it, starting with [Enhanced Failover Plugin](enhanced-failover). To check a combination before shipping, see [Plugin Compatibility](compatibility). +The wrapper supports other plugins and wrapper properties. For further information see the plugin pages, starting with [Enhanced Failover Plugin](enhanced-failover). Every wrapper property the examples did not use is listed with its type, default and unit on the plugin page that reads it. To check a combination before shipping, see [Plugin Compatibility](compatibility). Not sure which plugins you need? [Set up by Scenario](setup) builds a configuration from a few questions about your application. + From dc5ee34f02b3798526c647abed572dec2c1b253b Mon Sep 17 00:00:00 2001 From: karezche <64801825+karenc-bq@users.noreply.github.com> Date: Wed, 28 Oct 2026 15:39:13 -0700 Subject: [PATCH 3/3] chore: address comments about extra dependencies --- content/failover.yaml | 22 ++++++++++++---------- site/docs-ruby/overview.md | 22 ++++++++++++---------- 2 files changed, 24 insertions(+), 20 deletions(-) diff --git a/content/failover.yaml b/content/failover.yaml index 9aa1997..b631e13 100644 --- a/content/failover.yaml +++ b/content/failover.yaml @@ -105,16 +105,18 @@ wrappers: # than commented lines inside the main Gemfile. - text: | :::warning - If you are using Ruby 3.4 or later, and are not using Active Record, also add these to your Gemfile: - - ```ruby - gem 'base64' - gem 'bigdecimal' - gem 'logger' - ``` - - Ruby 3.4 removed these from the default gems, so a bundle without them - raises `LoadError` on the first require. + Which extra gems your Gemfile needs depends on your Ruby version, your platform, and whether you are using Active Record: + + | Version | Using Active Record | Extra gems | Reason | + | --- | --- | --- | --- | + | Ruby 3.3 | Either | None | `base64`, `bigdecimal` and `logger` are all still default gems | + | Ruby 3.4 | No | `base64`, `bigdecimal` | Ruby 3.4 removed both from the default gems | + | Ruby 3.4 | Yes | None | Active Record declares both itself | + | Ruby 4.0 or later | No | `base64`, `bigdecimal`, `logger` | Ruby 4.0 removed `logger` as well | + | Ruby 4.0 or later | Yes | None | Active Record declares all three itself | + | Ruby 4.0 or later, on Windows with `mysql2` | Either | `fiddle` | `mysql2` loads `libmysql.dll` through `fiddle` without declaring it, and neither does Active Record | + + A bundle missing any of them raises `LoadError` on the first require. ::: - title: "2. Point Active Record at your cluster" diff --git a/site/docs-ruby/overview.md b/site/docs-ruby/overview.md index 07b6ab1..537786c 100644 --- a/site/docs-ruby/overview.md +++ b/site/docs-ruby/overview.md @@ -38,16 +38,18 @@ bundle install Without Bundler, `gem install aws_advanced_ruby_driver_wrapper pg` does the same thing. :::warning -If you are using Ruby 3.4 or later, and are not using Active Record, also add these to your Gemfile: - -```ruby -gem 'base64' -gem 'bigdecimal' -gem 'logger' -``` - -Ruby 3.4 removed these from the default gems, so a bundle without them -raises `LoadError` on the first require. +Which extra gems your Gemfile needs depends on your Ruby version, your platform, and whether you are using Active Record: + +| Version | Using Active Record | Extra gems | Reason | +| --- | --- | --- | --- | +| Ruby 3.3 | Either | None | `base64`, `bigdecimal` and `logger` are all still default gems | +| Ruby 3.4 | No | `base64`, `bigdecimal` | Ruby 3.4 removed both from the default gems | +| Ruby 3.4 | Yes | None | Active Record declares both itself | +| Ruby 4.0 or later | No | `base64`, `bigdecimal`, `logger` | Ruby 4.0 removed `logger` as well | +| Ruby 4.0 or later | Yes | None | Active Record declares all three itself | +| Ruby 4.0 or later, on Windows with `mysql2` | Either | `fiddle` | `mysql2` loads `libmysql.dll` through `fiddle` without declaring it, and neither does Active Record | + +A bundle missing any of them raises `LoadError` on the first require. :::