Skip to content

Conversation

amotl
Copy link
Member

@amotl amotl commented Oct 16, 2025

@amotl amotl added the cross linking Linking to different locations of the documentation. label Oct 16, 2025
@coderabbitai
Copy link

coderabbitai bot commented Oct 16, 2025

Warning

Rate limit exceeded

@amotl has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 9 minutes and 45 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 4a7881d and cde4c11.

📒 Files selected for processing (2)
  • docs/connect/index.md (2 hunks)
  • docs/connect/r/index.md (1 hunks)

Walkthrough

Adds R support to the Connect docs: inserts an R driver card into the Drivers-by-language grid in docs/connect/index.md and adds a new docs/connect/r.md page that documents connecting to CrateDB from R using DBI + RPostgres/RPostgreSQL with examples for Cloud and local Docker, sample queries, and installation notes.

Changes

Cohort / File(s) Change Summary
Drivers grid / index
docs/connect/index.md
Inserts a new grid-item-card for the R driver into the Drivers by language section and updates the drivers toctree/list to include r.
R connection guide
docs/connect/r.md
Adds a new documentation page describing connection setup using DBI + RPostgres/RPostgreSQL, Cloud (sslmode="require") and local (Docker/Podman) examples, a sample SELECT query, install notes, example script/runner command, and links/badges to examples and packages.

Sequence Diagram(s)

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested labels

guidance

Suggested reviewers

  • kneth
  • surister

Poem

🐇
I hopped through docs to leave a trace,
Planted an R card in the drivers' place.
DBI, RPostgres — a tidy pair,
Queries hop out into open air.
Nibble, push, then off I race.

Pre-merge checks and finishing touches

❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Description Check ❓ Inconclusive The pull request description states "What the title says" and references a preview link, which is a minimal description that technically relates to the changeset since the PR title "Driver: Add page about R" and the changes are indeed about adding documentation for R connectivity. However, the description is extremely vague and uses a meta-reference to the title rather than providing actual descriptive content about what changes are included. The description does not convey meaningful information about the specific changes made, such as the addition of docs/connect/r.md and updates to docs/connect/index.md. Consider providing a more substantive pull request description that explicitly describes the changes being made, even if briefly. For example, the description could mention that it adds R driver documentation including a new page with connection examples using RPostgres and DBI, and updates the driver index accordingly. This would make the PR description more informative and easier to understand from the commit history.
✅ Passed checks (2 passed)
Check name Status Explanation
Title Check ✅ Passed The pull request title "Driver: Add page about R" directly and clearly summarizes the main change in the changeset. The raw_summary confirms that the PR adds a new documentation page for the R driver at docs/connect/r.md, along with updating the index to include the R driver card. The title is concise, specific, and provides enough context for a teammate reviewing the commit history to understand that this introduces R driver documentation.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

coderabbitai[bot]

This comment was marked as resolved.

@amotl amotl force-pushed the r-ng branch 2 times, most recently from b5dd4a8 to afad979 Compare October 16, 2025 10:48
coderabbitai[bot]

This comment was marked as resolved.

coderabbitai[bot]

This comment was marked as resolved.

Comment on lines 17 to 30
```r
# Install driver on demand.
# RPostgreSQL: R Interface to the 'PostgreSQL' Database System
# https://cran.r-project.org/web/packages/RPostgreSQL/

# Optionally install the PostgreSQL library.
if (!requireNamespace("RPostgreSQL", quietly = TRUE)) {
install.packages("RPostgreSQL", repos="https://cran.r-project.org")
}

# Load the DBI and PostgreSQL libraries.
library(DBI)
library(RPostgreSQL)
drv <- RPostgreSQL::PostgreSQL()
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@coderabbitai suggested:

17-31: Optional: mention RPostgres as the modern alternative.

RPostgres (PostgreSQL DBI driver) is actively maintained and often preferred; it also works with the PG wire protocol.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, two driver variants exist. Let's re-evaluate which one to present, or otherwise present both separately.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧩 Analysis chain

🌐 Web query:

RPostgres vs RPostgreSQL comparison 2024 2025 which is better actively maintained

💡 Result:

Short answer: RPostgres is the more actively maintained and recommended driver in 2024–2025 (modern C++ backend, DBI‑feature support); RPostgreSQL still exists and receives occasional updates but is older and less featureful. [1][2][3]

Quick evidence

  • RPostgres: actively maintained, CRAN/dev releases in 2024–2025, maintained by Kirill Müller and r-dbi with GitHub/CRAN activity and documentation. [1][4][5]
  • RPostgreSQL: older, C-backed driver with its last CRAN release notes in 2024 (and occasional 2025 packaging updates), but it is not the modern DBI implementation and lacks some features (e.g. full parameterized-query support) found in RPostgres. [6][2]

Recommendation

  • Use RPostgres for new projects (better performance, parameterised queries, automatic cleanup, active r-dbi maintenance). Use RPostgreSQL only if you have legacy code that depends on it. [1][4][6]

Sources

  1. RPostgres project page / r-dbi documentation (features, design, maintainer). [rpostgres.r-dbi.org].
  2. CRAN package page / CRAN-e listing for RPostgres (recent releases/versions).
  3. CRAN checks and r-universe/manual pages showing 2024–2025 builds and versions.
  4. RPostgres GitHub / r-dbi (source/docs/activity).
  5. RPostgreSQL CRAN/CRAN-e package page and release history (last upstream releases in 2024; occasional packaging updates in 2025).

If you want I can list the exact CRAN/GitHub release dates and links (with numbered citations).


🌐 Web query:

RPostgreSQL maintenance status CRAN last update

💡 Result:

RPostgreSQL is currently maintained; the latest CRAN release is version 0.7-8 (released March 28, 2025). Maintainer: Tomoaki Nishiyama. [1][2]

Sources:

  • CRAN update notice (RPostgreSQL 0.7-8, 2025-03-28). [1]
  • Package reference/manual (version 0.7-8; built 2025-07-29). [2]

🌐 Web query:

RPostgres modern R PostgreSQL driver best practices

💡 Result:

Quick best-practices for using RPostgres (concise):

  • Use the DBI + RPostgres API (DBI::dbConnect(RPostgres::Postgres())) and prefer RPostgres over RPostgreSQL (modern C++ backend, safer cleanup). (rpostgres.r-dbi.org)
  • Use parameterized queries / prepared statements (dbSendQuery() + dbBind() or dbExecute()/params) to prevent SQL injection and reuse plans. (dbi.r-dbi.org)
  • Manage transactions explicitly when needed: DBI::dbBegin()/dbCommit()/dbRollback() (or savepoints) to ensure atomicity. Use on.exit()/withr::defer() to always close/rollback on error. (rpostgres.r-dbi.org)
  • Use a connection pool (pool::dbPool) in long‑running apps (Shiny, Plumber) rather than opening ad‑hoc connections; tune minSize/maxSize and idleTimeout and always poolClose() on shutdown. (rstudio.github.io)
  • Fetch large results in chunks: dbSendQuery() → dbFetch(n) → dbClearResult() to avoid OOM. Use dbGetQuery() only if result fits memory. (r-dbi.r-universe.dev)
  • Bulk writes: prefer DBI::dbWriteTable(..., copy = TRUE) or COPY-based approaches for large data loads (use server-side COPY where supported). Validate types (bigint → integer64) and cast params if needed (e.g. "$1::bigint"). (r-dbi.r-universe.dev)
  • Enforce TLS/SSL and least-privilege DB credentials for production; supply host/sslmode and use managed secrets (env vars, keyvault) rather than hardcoding. (rpostgres.r-dbi.org)
  • Clean up: always dbClearResult(), dbDisconnect() (or poolClose()); use on.exit() / withr::defer() to avoid leaks. RPostgres auto-cleans more than older drivers but explicit cleanup is still best practice. (rpostgres.r-dbi.org)
  • Monitor & right-size: monitor active connections on Postgres side, set pool max below DB max_connections, add retry/backoff for transient failures. (compilenrun.com)
  • Use dbplyr for pushdown where appropriate (let the DB do filtering/aggregation); ensure proper indexing and examine query plans for hotspots. (rstudio.github.io)

If you want, I can produce copy‑pasteable example snippets for: (a) secure dbPool usage, (b) parameterized dbBind pattern, or (c) a safe transaction pattern. Which one first?

Citations:


@amotl, based on current information, here's my recommendation:

Key Differences

RPostgres (recommended):

  • Modern, actively maintained by the r-dbi team
  • C++ backend with better performance
  • Full DBI feature support including parameterized queries
  • Automatic connection cleanup
  • Preferred for new projects in 2024-2025

RPostgreSQL:

  • Older C-backed driver
  • Still maintained (v0.7-8 released March 2025)
  • Less featureful than RPostgres
  • Typically only used for legacy code compatibility

Recommendation

I suggest switching to RPostgres as the primary driver in your documentation since:

  1. This is new documentation (not maintaining legacy code)
  2. RPostgres is the community-recommended modern approach
  3. Both work with the PostgreSQL wire protocol, so both should work with CrateDB

You could optionally add a brief note mentioning RPostgreSQL as an alternative for users with existing code, but keeping the main example with RPostgres would be clearer and more helpful.

Would you like me to help update the code example to use RPostgres instead? The changes would be minimal:

# Install RPostgres instead
if (!requireNamespace("RPostgres", quietly = TRUE)) {
    install.packages("RPostgres", repos="https://cran.r-project.org")
}

library(DBI)
library(RPostgres)
# No need to create drv object - use RPostgres::Postgres() directly in dbConnect()

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@coderabbitai: Switched per cdbcf93.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check the commit referenced by the user
git show cdbcf938561 --stat
echo "---"
# Show the actual changes in the R documentation file
git show cdbcf938561 -- docs/connect/r.md

Length of output: 3373


@amotl Perfect! The changes look excellent. You've successfully switched to RPostgres as the primary driver while thoughtfully keeping RPostgreSQL mentioned as an alternative.

The implementation is clean and follows best practices:

  • ✅ Uses RPostgres::Postgres() directly in dbConnect() (no need for the intermediate drv object)
  • ✅ Clear explanation that RPostgres is actively maintained and preferred
  • ✅ Still mentions RPostgreSQL for users who might need it
  • ✅ Updated all references, comments, and examples consistently

The documentation now provides modern, recommended guidance for R users connecting to CrateDB. Great work!

♪┏(・o・)┛♪┗ ( ・o・) ┓♪

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@coderabbitai: Thank you for pointing out RPostgres, so we have been able to improve our docs. 💯

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@amotl You're very welcome! I'm glad the suggestion was helpful. The documentation now reflects the modern best practices for R users, which will benefit the community. Happy to assist anytime! 🚀

coderabbitai[bot]

This comment was marked as resolved.

@amotl amotl force-pushed the r-ng branch 2 times, most recently from 2756c81 to 08b6054 Compare October 20, 2025 15:07
coderabbitai[bot]

This comment was marked as resolved.

coderabbitai[bot]

This comment was marked as resolved.

@amotl amotl added the new content New content being added. label Oct 20, 2025
Copy link
Member Author

@amotl amotl Oct 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that there is a dedicated section about programming languages, let's relocate content from that one, which was slotted into the integration section instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cross linking Linking to different locations of the documentation. new content New content being added.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant