Skip to contents

Commits the current transaction, making all changes permanent. Optionally adds metadata (author, commit message, and extra info) to the snapshot.

Usage

commit_transaction(
  conn = NULL,
  author = NULL,
  commit_message = NULL,
  commit_extra_info = NULL
)

Arguments

conn

Optional DuckDB connection object. If not provided, uses the default ducklake connection.

author

Optional author name to associate with the snapshot

commit_message

Optional commit message describing the changes

commit_extra_info

Optional extra information about the commit

Value

Invisibly returns TRUE on success

Details

This function commits all changes made since begin_transaction() was called, making them permanent in the database.

If author, commit_message, or commit_extra_info are provided, they will be set using CALL ducklake.set_commit_message() within the transaction before the COMMIT statement, as required by the DuckLake v1.0 specification.

Examples

if (FALSE) { # \dontrun{
# Basic commit
begin_transaction()
# ... make changes ...
commit_transaction()

# Commit with metadata
begin_transaction()
create_table(mtcars, "cars")
commit_transaction(
  author = "John Doe",
  commit_message = "Add cars dataset"
)
} # }